it-tools/src/tools/json-to-go/json-to-go.service.test.ts
sharevb 47888b542d feat(new tool): Json to Go
Fix #655. Taken from #732
2024-05-15 23:03:02 +02:00

21 lines
686 B
TypeScript

import { describe, expect, it } from 'vitest';
import { jsonToGo } from './json-to-go.service';
import testCases from './json-to-go.test.data.json';
describe('json-to-go', () => {
describe('jsonToGo', () => {
for (const includeExampleData of [true, false]) {
it(`must return correct results (includeExampleData = ${includeExampleData})`, () => {
for (const testCase of testCases) {
const got = jsonToGo(testCase.input, '', false, includeExampleData);
const expected = includeExampleData
? testCase.expectedWithExample
: testCase.expected;
expect(got.go).to.equal(expected);
}
});
}
});
});