wzp
2021-05-13 7d694a9113118daec5be7ac224dab46a3b20f106
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'use strict'
 
const t = require('tap')
const test = t.test
const FindMyWay = require('../')
const noop = () => {}
 
test('Should keep semver store when split node', t => {
  t.plan(4)
 
  const findMyWay = FindMyWay()
 
  findMyWay.on('GET', '/t1', { version: '1.0.0' }, noop)
  findMyWay.on('GET', '/t2', { version: '2.1.0' }, noop)
 
  t.ok(findMyWay.find('GET', '/t1', '1.0.0'))
  t.ok(findMyWay.find('GET', '/t2', '2.x'))
  t.notOk(findMyWay.find('GET', '/t1', '2.x'))
  t.notOk(findMyWay.find('GET', '/t2', '1.0.0'))
})