debian-mirror-gitlab/spec/frontend/pipeline_new/utils/format_refs_spec.js
2021-03-11 19:13:27 +05:30

22 lines
836 B
JavaScript

import { BRANCH_REF_TYPE, TAG_REF_TYPE } from '~/pipeline_new/constants';
import formatRefs from '~/pipeline_new/utils/format_refs';
import { mockBranchRefs, mockTagRefs } from '../mock_data';
describe('Format refs util', () => {
it('formats branch ref correctly', () => {
expect(formatRefs(mockBranchRefs, BRANCH_REF_TYPE)).toEqual([
{ fullName: 'refs/heads/master', shortName: 'master' },
{ fullName: 'refs/heads/dev', shortName: 'dev' },
{ fullName: 'refs/heads/release', shortName: 'release' },
]);
});
it('formats tag ref correctly', () => {
expect(formatRefs(mockTagRefs, TAG_REF_TYPE)).toEqual([
{ fullName: 'refs/tags/1.0.0', shortName: '1.0.0' },
{ fullName: 'refs/tags/1.1.0', shortName: '1.1.0' },
{ fullName: 'refs/tags/1.2.0', shortName: '1.2.0' },
]);
});
});