|
|
@@ -1,23 +0,0 @@
|
|
|
-import {describe, test, expect} from "vitest";
|
|
|
-import YamlEncoder from "~/services/encoder/yamlEncoder";
|
|
|
-import {load} from "js-yaml";
|
|
|
-
|
|
|
-
|
|
|
-describe('encode', () => {
|
|
|
- test('simple conversion', () => {
|
|
|
- const result = YamlEncoder.encode({title: {a: 1, b: 2, c: ['foo', 'bar']}})
|
|
|
- expect(result).toEqual(`title:\n a: 1\n b: 2\n c:\n - foo\n - bar\n`)
|
|
|
- })
|
|
|
-})
|
|
|
-
|
|
|
-describe('decode', () => {
|
|
|
- test('with empty data', () => {
|
|
|
- const result = YamlEncoder.decode("")
|
|
|
-
|
|
|
- expect(result).toBeNull()
|
|
|
- })
|
|
|
- test('with data', () => {
|
|
|
- const result = YamlEncoder.decode(`title:\n a: 1\n b: 2\n c: [foo, bar]`)
|
|
|
- expect(result).toEqual({title: {a: 1, b: 2, c: ['foo', 'bar']}})
|
|
|
- })
|
|
|
-})
|