mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-11 19:35:32 +00:00
23 lines
690 B
TypeScript
23 lines
690 B
TypeScript
import {parseWordList} from '../lexical-model-compiler/build-trie';
|
|
import {assert} from 'chai';
|
|
import 'mocha';
|
|
|
|
import path = require('path');
|
|
|
|
const BOM = '\ufeff';
|
|
|
|
describe('parseWordList', function () {
|
|
it('should remove the UTF-8 byte order mark from files', function () {
|
|
let word = 'hello';
|
|
let count = 1;
|
|
let expected = [
|
|
[word, count]
|
|
];
|
|
let file = `# this is a comment\n${word}\t${count}`;
|
|
let withoutBOM = parseWordList(file);
|
|
assert.deepEqual(withoutBOM, expected, "expected regular file to parse properly");
|
|
let withBOM = parseWordList(`${BOM}${file}`)
|
|
assert.deepEqual(withBOM, expected, "expected BOM to be ignored");
|
|
});
|
|
});
|
|
|