spiegel-keyman/developer/src/kmc-ldml/test/test-testdata-e2e.ts
Marc Durdin d3ee8c9802 feat(developer): LdmlKeyboardCompiler now implements KeymanCompiler
Relates to #9473.

Refactors the public API of LdmlKeyboardCompiler to meet KeymanCompiler,
including asyncing a bunch of functions, and moving file write
responsibilities out of kmc and into kmc-ldml.
2023-12-07 11:42:10 +07:00

25 lines
1 KiB
TypeScript

import { readFileSync } from 'fs';
import 'mocha';
import {assert} from 'chai';
import {compilerTestOptions, loadTestData, makePathToFixture} from './helpers/index.js';
describe('testdata-tests', function() {
this.slow(500); // 0.5 sec -- json schema validation takes a while
it('should-build-testdata-fixtures', async function() {
// Let's build test-fr.json
// It should match test-fr.json (built from test-fr.xml)
// Note! There's another test case against similar data, in common/web/types/test/ldml-keyboard/test-ldml-keyboard-testdata-reader.ts
const inputFilename = makePathToFixture('test-fr.xml');
const jsonFilename = makePathToFixture('test-fr.json');
// Compile the keyboard
const testData = await loadTestData(inputFilename, {...compilerTestOptions, saveDebug: true, shouldAddCompilerVersion: false});
assert.isNotNull(testData);
const jsonData = JSON.parse(readFileSync(jsonFilename, 'utf-8'));
assert.deepEqual(testData, jsonData, 'parsed +test-fr.xml should match -test-fr.json');
});
});