mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Simplify kwfilter
This commit is contained in:
12
Build/lib/aho-corasick.test.ts
Normal file
12
Build/lib/aho-corasick.test.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// eslint-disable-next-line import/no-unresolved -- bun
|
||||
import { describe, expect, it } from 'bun:test';
|
||||
import createKeywordFilter from './aho-corasick';
|
||||
|
||||
describe('AhoCorasick', () => {
|
||||
it('basic', () => {
|
||||
const kwfilter = createKeywordFilter(['ap', 'an']);
|
||||
expect(kwfilter('bananan')).toBeTrue();
|
||||
expect(kwfilter('apple')).toBeTrue();
|
||||
expect(kwfilter('melon')).toBeFalse();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user