fix(core): update
This commit is contained in:
@ -8,8 +8,8 @@ tap.test('first test', async () => {
|
||||
expect(testrouter).to.be.instanceOf(smartrouter.SmartRouter);
|
||||
});
|
||||
|
||||
tap.test('should handle a route change', async (tools) => {
|
||||
const done = tools.defer();
|
||||
tap.test('should handle a route change', async (toolsArg) => {
|
||||
const done = toolsArg.defer();
|
||||
testrouter.on('/myawesomeroute/:any', async (routeInfoArg) => {
|
||||
expect(routeInfoArg.params.any).to.equal('hello');
|
||||
done.resolve();
|
||||
@ -18,8 +18,8 @@ tap.test('should handle a route change', async (tools) => {
|
||||
await done.promise;
|
||||
});
|
||||
|
||||
tap.test('should handle a route change', async (tools) => {
|
||||
const done = tools.defer();
|
||||
tap.test('should handle a route change', async (toolsArg) => {
|
||||
const done = toolsArg.defer();
|
||||
testrouter.on('/myawesomeroute2/:wow', async (routeInfoArg) => {
|
||||
expect(routeInfoArg.params.wow).to.equal('hello2');
|
||||
done.resolve();
|
||||
@ -29,4 +29,18 @@ tap.test('should handle a route change', async (tools) => {
|
||||
expect(window.location.href).to.equal('http://localhost:3007/myawesomeroute2/hello2');
|
||||
});
|
||||
|
||||
tap.test('should find a query param', async (toolsArg) => {
|
||||
const done = toolsArg.defer();
|
||||
testrouter.on('/myawesomeroute2/:wow', async (routeInfoArg) => {
|
||||
expect(routeInfoArg.params.wow).to.equal('hello2');
|
||||
expect(routeInfoArg.queryParams.aparam).to.equal('Yes');
|
||||
console.log('Here is what queryParams looks like');
|
||||
console.log(JSON.stringify(routeInfoArg.queryParams))
|
||||
done.resolve();
|
||||
});
|
||||
testrouter.pushUrl('/myawesomeroute2/hello2?aparam=Yes');
|
||||
await done.promise;
|
||||
expect(window.location.href).to.equal('http://localhost:3007/myawesomeroute2/hello2?aparam=Yes');
|
||||
})
|
||||
|
||||
tap.start();
|
||||
|
Reference in New Issue
Block a user