debian-mirror-gitlab/spec/frontend/registry/settings/utils_spec.js

35 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-01-03 14:25:43 +05:30
import {
formOptionsGenerator,
optionLabelGenerator,
olderThanTranslationGenerator,
2021-02-22 17:27:13 +05:30
} from '~/registry/settings/utils';
2021-01-03 14:25:43 +05:30
describe('Utils', () => {
describe('optionLabelGenerator', () => {
it('returns an array with a set label', () => {
const result = optionLabelGenerator(
[{ variable: 1 }, { variable: 2 }],
olderThanTranslationGenerator,
);
2021-02-22 17:27:13 +05:30
expect(result).toEqual([{ variable: 1, label: '1 day' }, { variable: 2, label: '2 days' }]);
2021-01-03 14:25:43 +05:30
});
});
describe('formOptionsGenerator', () => {
it('returns an object containing olderThan', () => {
expect(formOptionsGenerator().olderThan).toBeDefined();
expect(formOptionsGenerator().olderThan).toMatchSnapshot();
});
it('returns an object containing cadence', () => {
expect(formOptionsGenerator().cadence).toBeDefined();
expect(formOptionsGenerator().cadence).toMatchSnapshot();
});
it('returns an object containing keepN', () => {
expect(formOptionsGenerator().keepN).toBeDefined();
expect(formOptionsGenerator().keepN).toMatchSnapshot();
});
});
});