diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-08 12:09:53 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-08 12:09:53 +0000 |
commit | 148b75b329294f6b6ae409bbf8d70590e63c6bc9 (patch) | |
tree | 30918a97e353067ff9c99e04fb7e296305d130b7 /spec/frontend/registry/settings/utils_spec.js | |
parent | 707742e59ca57d1f2ea00d65fa35a7b9a5ded398 (diff) | |
download | gitlab-ce-148b75b329294f6b6ae409bbf8d70590e63c6bc9.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/registry/settings/utils_spec.js')
-rw-r--r-- | spec/frontend/registry/settings/utils_spec.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/frontend/registry/settings/utils_spec.js b/spec/frontend/registry/settings/utils_spec.js new file mode 100644 index 00000000000..f92d51db307 --- /dev/null +++ b/spec/frontend/registry/settings/utils_spec.js @@ -0,0 +1,34 @@ +import { + formOptionsGenerator, + optionLabelGenerator, + olderThanTranslationGenerator, +} from '~/registry/settings/utils'; + +describe('Utils', () => { + describe('optionLabelGenerator', () => { + it('returns an array with a set label', () => { + const result = optionLabelGenerator( + [{ variable: 1 }, { variable: 2 }], + olderThanTranslationGenerator, + ); + expect(result).toEqual([{ variable: 1, label: '1 day' }, { variable: 2, label: '2 days' }]); + }); + }); + + 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(); + }); + }); +}); |