mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 16:35:33 +00:00
31 lines
893 B
TypeScript
31 lines
893 B
TypeScript
import 'mocha';
|
|
import {assert} from 'chai';
|
|
|
|
import {compileModel} from '../dist/util/util';
|
|
import {makePathToFixture, compileModelSourceCode, CompilationResult} from './helpers';
|
|
|
|
describe('compileModel', function () {
|
|
// Try to compile ALL of the correct models.
|
|
const MODELS = [
|
|
'example.qaa.sencoten',
|
|
'example.qaa.trivial',
|
|
'example.qaa.utf16le',
|
|
];
|
|
|
|
for (let modelID of MODELS) {
|
|
let modelPath = makePathToFixture(modelID, `${modelID}.model.ts`);
|
|
|
|
it(`should compile ${modelID}`, function () {
|
|
let code = compileModel(modelPath);
|
|
let r;
|
|
assert.doesNotThrow(() => {
|
|
r = compileModelSourceCode(code);
|
|
});
|
|
let compilation = r as CompilationResult;
|
|
|
|
assert.isFalse(compilation.hasSyntaxError);
|
|
assert.isNull(compilation.error);
|
|
assert.equal(compilation.modelConstructorName, 'TrieModel');
|
|
});
|
|
}
|
|
});
|