import { compileTrie } from './compileTrie' import { Trie } from './Trie' const makeTrie = (name: string, ...paths: string[]) => { const trie = new Trie() for (const key of paths) { trie.mapValue(key.split('/'), () => `${name} ${key}`) } return trie } test('compileTrie', () => { expect(compileTrie({ baseTrie: makeTrie('main', ':/bar', ':/:' ), extraTries: [ makeTrie('extra1','foo/:'), makeTrie('extra2', ':/*') ] }).toJSON()).toEqual({ ":>:": [ "extra2 :/*", "main :/:" ], ":>bar": [ "extra2 :/*", "main :/bar" ], "foo>:": [ "extra2 :/*", "extra1 foo/:", "main :/:" ], "foo>bar": [ "extra2 :/*", "extra1 foo/:", "main :/bar" ] }) })