diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-04-30 14:00:07 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-02 11:14:19 +0900 |
commit | c60d0e7392fc708e961614d6b756a045de74f458 (patch) | |
tree | 0b9a5fce1879e38a92d5dbb2915779aee0ad22d6 /test/shared/utils/re.test.ts | |
parent | 257162e5b6b4993e1dff0d705ffa6f0d809033eb (diff) |
Rename .js/.jsx to .ts/.tsx
Diffstat (limited to 'test/shared/utils/re.test.ts')
-rw-r--r-- | test/shared/utils/re.test.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/shared/utils/re.test.ts b/test/shared/utils/re.test.ts new file mode 100644 index 0000000..d12ceb7 --- /dev/null +++ b/test/shared/utils/re.test.ts @@ -0,0 +1,19 @@ +import * as re from 'shared/utils/re'; + +describe("re util", () => { + it('matches by pattern', () => { + let regex = re.fromWildcard('*.example.com/*'); + expect('foo.example.com/bar').to.match(regex); + expect('foo.example.com').not.to.match(regex); + expect('example.com/bar').not.to.match(regex); + + regex = re.fromWildcard('example.com/*') + expect('example.com/foo').to.match(regex); + expect('example.com/').to.match(regex); + + regex = re.fromWildcard('example.com/*bar') + expect('example.com/foobar').to.match(regex); + expect('example.com/bar').to.match(regex); + expect('example.com/foobarfoo').not.to.match(regex); + }) +}); |