Fixed tests (#4)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Yusuke Wada · committed by GitHub · parent cea29c7 · Browse files · 2 files·+22 added−18 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+22 added−18 removed
- tests:+22 added−18 removed
Provenance
- Commit
7448ec0- Tree
7ebb339- Author
Yusuke Wada <yusuke@kamawada.com>- Committer
GitHub <noreply@github.com>- Parent
cea29c7
2 files changed+22 added−18 removed
deleted:src/node.root.test.js-17 removed
1234567891011121314151617const Node = require('./node')
describe('Basic Usage', () => { const node = new Node() node.insert('get', '/', 'get root') it('get /', () => { expect(node.search('get', '/')).not.toBeNull() })})
describe('Basic Usage', () => { const node = new Node() node.insert('get', '/hello', 'get hello') it('get /', () => { expect(node.search('get', '/')).toBeNull() })})modified:src/node.test.js+22 added-1 removed
1223456789101112131415161718192021222324252627282930313233343518 unmodified lines54555657585960616219 unmodified lines82838485868788899091929394959697989910015 unmodified lines1161171181191201211221231246 unmodified linesconst Node = require('./node')const node = new Node()
describe('Util Methods', () => { const node = new Node() it('node.splitPath', () => { let ps = node.splitPath('/') expect(ps[0]).toBe('/') ps = node.splitPath('/hello') expect(ps[0]).toBe('/') expect(ps[1]).toBe('hello') })})
describe('Root Node', () => { const node = new Node() node.insert('get', '/', 'get root') it('get /', () => { expect(node.search('get', '/')).not.toBeNull() })})
describe('Root Node', () => { const node = new Node() node.insert('get', '/hello', 'get hello') it('get /', () => { expect(node.search('get', '/')).toBeNull() })})
describe('Basic Usage', () => { const node = new Node() node.insert('get', '/hello', 'get hello') node.insert('post', '/hello', 'post hello') node.insert('get', '/hello/foo', 'get hello foo')
18 unmodified lines })})
describe('Name path', () => { const node = new Node() it('get /entry/123', () => { node.insert('get', '/entry/:id', 'get entry') let res = node.search('get', '/entry/123') expect(res).not.toBeNull()19 unmodified lines })})
describe('Wildcard', () => { const node = new Node() it('/wildcard-abc/xxxxxx/wildcard-efg', () => { node.insert('get', '/wildcard-abc/*/wildcard-efg', 'wildcard') res = node.search('get', '/wildcard-abc/xxxxxx/wildcard-efg') expect(res).not.toBeNull() expect(res.handler).toBe('wildcard') })})
describe('Regexp', () => { const node = new Node() node.insert( 'get', '/regex-abc/:id{[0-9]+}/comment/:comment_id{[a-z]+}', 'regexp'15 unmodified lines })})
describe('All', () => { const node = new Node() node.insert('all', '/all-methods', 'all methods') it('/all-methods', () => { res = node.search('get', '/all-methods') expect(res).not.toBeNull()6 unmodified lines