diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-11-12 18:25:14 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-12 18:25:14 +0900 |
commit | c7b05482f33cc778e1966faa9354ea46b490a115 (patch) | |
tree | b73bc6e5a6468d8c5a1118dcfb61f9d00b1aa5cf /test/shared/utils/re.test.js | |
parent | 3af2e3154ed6b56400d02fc3d726bfc7186f372a (diff) | |
parent | ccf3c7b421e804172827dd34a995290afc85af10 (diff) |
Merge pull request #132 from ueokande/meta-keys
Meta keys
Diffstat (limited to 'test/shared/utils/re.test.js')
-rw-r--r-- | test/shared/utils/re.test.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/shared/utils/re.test.js b/test/shared/utils/re.test.js new file mode 100644 index 0000000..9ed6521 --- /dev/null +++ b/test/shared/utils/re.test.js @@ -0,0 +1,20 @@ +import { expect } from 'chai'; +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); + }) +}); |