Housekeeping

This commit is contained in:
SukkaW
2024-10-17 16:28:57 +08:00
parent e18f57f568
commit 5aee1b6870
6 changed files with 382 additions and 169 deletions

View File

@@ -1,17 +1,17 @@
import { describe, it } from 'mocha';
import { expect } from 'chai';
import { expect } from 'expect';
import createKeywordFilter from './aho-corasick';
describe('AhoCorasick', () => {
it('basic', () => {
let kwfilter = createKeywordFilter(['ap', 'an']);
expect(kwfilter('bananan')).to.equal(true);
expect(kwfilter('apple')).to.equal(true);
expect(kwfilter('melon')).to.equal(false);
expect(kwfilter('bananan')).toBe(true);
expect(kwfilter('apple')).toBe(true);
expect(kwfilter('melon')).toBe(false);
kwfilter = createKeywordFilter(['cdn', 'sukka']);
expect(kwfilter('bananan')).to.equal(false);
expect(kwfilter('apple')).to.equal(false);
expect(kwfilter('melon')).to.equal(false);
expect(kwfilter('bananan')).toBe(false);
expect(kwfilter('apple')).toBe(false);
expect(kwfilter('melon')).toBe(false);
});
});