Buckets:
| const { test } = require('node:test') | |
| const FindMyWay = require('../') | |
| test('handler should have the store object', t => { | |
| t.plan(1) | |
| const findMyWay = FindMyWay() | |
| findMyWay.on('GET', '/test', (req, res, params, store) => { | |
| t.assert.equal(store.hello, 'world') | |
| }, { hello: 'world' }) | |
| findMyWay.lookup({ method: 'GET', url: '/test', headers: {} }, null) | |
| }) | |
| test('find a store object', t => { | |
| t.plan(1) | |
| const findMyWay = FindMyWay() | |
| const fn = () => {} | |
| findMyWay.on('GET', '/test', fn, { hello: 'world' }) | |
| t.assert.deepEqual(findMyWay.find('GET', '/test'), { | |
| handler: fn, | |
| params: {}, | |
| store: { hello: 'world' }, | |
| searchParams: {} | |
| }) | |
| }) | |
| test('update the store', t => { | |
| t.plan(2) | |
| const findMyWay = FindMyWay() | |
| let bool = false | |
| findMyWay.on('GET', '/test', (req, res, params, store) => { | |
| if (!bool) { | |
| t.assert.equal(store.hello, 'world') | |
| store.hello = 'hello' | |
| bool = true | |
| findMyWay.lookup({ method: 'GET', url: '/test', headers: {} }, null) | |
| } else { | |
| t.assert.equal(store.hello, 'hello') | |
| } | |
| }, { hello: 'world' }) | |
| findMyWay.lookup({ method: 'GET', url: '/test', headers: {} }, null) | |
| }) | |
Xet Storage Details
- Size:
- 1.2 kB
- Xet hash:
- 9c936a3fe4c6e0816706123aca3760b0ea0a9dfce85c2df160315f1de1fd7658
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.