chardet/.github/workflows/test-build.js

22 lines
790 B
JavaScript
Raw Permalink Normal View History

2022-09-30 02:41:58 +00:00
const assert = require('assert');
const chardet = require(process.cwd());
assert(typeof chardet.analyse, 'function');
assert(typeof chardet.detect, 'function');
assert(typeof chardet.detectFile, 'function');
assert(typeof chardet.detectFileSync, 'function');
assert.deepStrictEqual(chardet.analyse(Buffer.from('This is a test')), [
{ confidence: 98, name: 'ISO-8859-1', lang: 'en' },
{ confidence: 98, name: 'ISO-8859-2', lang: 'hu' },
{ confidence: 10, name: 'UTF-8', lang: undefined },
{ confidence: 10, name: 'Shift_JIS', lang: 'ja' },
{ confidence: 10, name: 'Big5', lang: 'zh' },
{ confidence: 10, name: 'EUC-JP', lang: 'ja' },
{ confidence: 10, name: 'EUC-KR', lang: 'ko' },
{ confidence: 10, name: 'GB18030', lang: 'zh' },
]);
console.log(' > test-build.js OK');