Skip to content

Commit

Permalink
chore: assert $.run drops query string;
Browse files Browse the repository at this point in the history
- See #9
  • Loading branch information
lukeed committed Jun 3, 2019
1 parent 1062d25 commit e7aa014
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,25 @@ test('$.run (wildcard)', t => {
ctx.run('foo/bar/baz/bat/quz');
});

test('$.run (query)', t => {
t.plan(4);

let ctx = (
navaid()
.on('foo/*', o => {
t.pass('~> called "foo/*" route');
t.is(o.wild, 'baz/bat', '~> trims query from "wild" key');
})
.on('/bar/:id', o => {
t.pass('~> called "/bar/:id" route');
t.is(o.id, 'hello', '~> trims query from "id" key');
})
);

ctx.run('foo/baz/bat?abc=123');
ctx.run('bar/hello?a=b&c=d');
});

test('$.run (404)', t => {
t.plan(11);

Expand Down

0 comments on commit e7aa014

Please sign in to comment.