spiegel-keyman/developer/src/kmc-ldml/test/test-visual-keyboard-compiler-e2e.ts
Steven R. Loomis c42615420d feat(developer): err/hint on illegal/pua 🙀
- also found that kmc's validate() should have been async but wasn't, a little bit of churn because of this
- unassigned not implemented yet, but tests in place for it.
- change SectionCompiler.postValidate to only be called during the validate() run of compilation. This way messages will only show once.

For: #9446
2023-11-17 22:41:58 +00:00

31 lines
1.2 KiB
TypeScript

import 'mocha';
import {assert} from 'chai';
import hextobin from '@keymanapp/hextobin';
import { KvkFileWriter } from '@keymanapp/common-types';
import {checkMessages, compilerTestOptions, compileVisualKeyboard, makePathToFixture} from './helpers/index.js';
describe('visual-keyboard-compiler', function() {
this.slow(500); // 0.5 sec -- json schema validation takes a while
it('should build fixtures', async function() {
// Let's build basic.xml
// It should match basic.kvk (built from basic-kvk.txt)
const inputFilename = makePathToFixture('basic.xml');
const binaryFilename = makePathToFixture('basic-kvk.txt');
// Compile the visual keyboard
const vk = await compileVisualKeyboard(inputFilename, {...compilerTestOptions, saveDebug: true, shouldAddCompilerVersion: false});
assert.isNotNull(vk);
// Use the builder to generate the binary output file
const writer = new KvkFileWriter();
const code = writer.write(vk);
checkMessages();
assert.isNotNull(code);
// Compare output
let expected = await hextobin(binaryFilename, undefined, {silent:true});
assert.deepEqual<Uint8Array>(code, expected);
});
});