diff options
Diffstat (limited to 'spec/frontend/static_site_editor/services/front_matterify_spec.js')
-rw-r--r-- | spec/frontend/static_site_editor/services/front_matterify_spec.js | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/spec/frontend/static_site_editor/services/front_matterify_spec.js b/spec/frontend/static_site_editor/services/front_matterify_spec.js deleted file mode 100644 index ec3752b30c6..00000000000 --- a/spec/frontend/static_site_editor/services/front_matterify_spec.js +++ /dev/null @@ -1,54 +0,0 @@ -import { frontMatterify, stringify } from '~/static_site_editor/services/front_matterify'; -import { - sourceContentYAML as content, - sourceContentHeaderObjYAML as yamlFrontMatterObj, - sourceContentSpacing as spacing, - sourceContentBody as body, -} from '../mock_data'; - -describe('static_site_editor/services/front_matterify', () => { - const frontMatterifiedContent = { - source: content, - matter: yamlFrontMatterObj, - hasMatter: true, - spacing, - content: body, - delimiter: '---', - type: 'yaml', - }; - const frontMatterifiedBody = { - source: body, - matter: null, - hasMatter: false, - spacing: null, - content: body, - delimiter: null, - type: null, - }; - - describe('frontMatterify', () => { - it.each` - frontMatterified | target - ${frontMatterify(content)} | ${frontMatterifiedContent} - ${frontMatterify(body)} | ${frontMatterifiedBody} - `('returns $target from $frontMatterified', ({ frontMatterified, target }) => { - expect(frontMatterified).toEqual(target); - }); - - it('should throw when matter is invalid', () => { - const invalidContent = `---\nkey: val\nkeyNoVal\n---\n${body}`; - - expect(() => frontMatterify(invalidContent)).toThrow(); - }); - }); - - describe('stringify', () => { - it.each` - stringified | target - ${stringify(frontMatterifiedContent)} | ${content} - ${stringify(frontMatterifiedBody)} | ${body} - `('returns $target from $stringified', ({ stringified, target }) => { - expect(stringified).toBe(target); - }); - }); -}); |