diff options
Diffstat (limited to 'test/shared/blacklists.test.ts')
-rw-r--r-- | test/shared/blacklists.test.ts | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/test/shared/blacklists.test.ts b/test/shared/blacklists.test.ts deleted file mode 100644 index 289ea0f..0000000 --- a/test/shared/blacklists.test.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { includes } from 'shared/blacklists'; - -describe("shared/blacklist", () => { - it('matches by *', () => { - let blacklist = ['*']; - - expect(includes(blacklist, 'https://github.com/abc')).to.be.true; - }) - - it('matches by hostname', () => { - let blacklist = ['github.com']; - - expect(includes(blacklist, 'https://github.com')).to.be.true; - expect(includes(blacklist, 'https://gist.github.com')).to.be.false; - expect(includes(blacklist, 'https://github.com/ueokande')).to.be.true; - expect(includes(blacklist, 'https://github.org')).to.be.false; - expect(includes(blacklist, 'https://google.com/search?q=github.org')).to.be.false; - }) - - it('matches by hostname with wildcard', () => { - let blacklist = ['*.github.com']; - - expect(includes(blacklist, 'https://github.com')).to.be.false; - expect(includes(blacklist, 'https://gist.github.com')).to.be.true; - }) - - it('matches by path', () => { - let blacklist = ['github.com/abc']; - - expect(includes(blacklist, 'https://github.com/abc')).to.be.true; - expect(includes(blacklist, 'https://github.com/abcdef')).to.be.false; - expect(includes(blacklist, 'https://gist.github.com/abc')).to.be.false; - }) - - it('matches by path with wildcard', () => { - let blacklist = ['github.com/abc*']; - - expect(includes(blacklist, 'https://github.com/abc')).to.be.true; - expect(includes(blacklist, 'https://github.com/abcdef')).to.be.true; - expect(includes(blacklist, 'https://gist.github.com/abc')).to.be.false; - }) - - it('matches address and port', () => { - let blacklist = ['127.0.0.1:8888']; - - expect(includes(blacklist, 'http://127.0.0.1:8888/')).to.be.true; - expect(includes(blacklist, 'http://127.0.0.1:8888/hello')).to.be.true; - }) -}); |