Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('uses consequtive hooks', async function () {
const { router, tearDown, navigationInstruction } = await createFixture();
const sut = new HookManager();
sut.addHook((url: string, navigationInstruction: INavigatorInstruction) => Promise.resolve(`hooked:${url}`),
{ type: HookTypes.TransformFromUrl });
sut.addHook((url: string, navigationInstruction: INavigatorInstruction) => Promise.resolve(`hooked2:${url}`),
{ type: HookTypes.TransformFromUrl });
const hooked = await sut.invokeTransformFromUrl('testing', navigationInstruction);
assert.strictEqual(hooked, 'hooked2:hooked:testing', `hooked`);
await tearDown();
});
it('uses a hook', async function () {
const { router, tearDown, navigationInstruction } = await createFixture();
const sut = new HookManager();
sut.addHook((url: string, navigationInstruction: INavigatorInstruction): Promise => Promise.resolve(`hooked:${url}`),
{ type: HookTypes.TransformFromUrl });
const hooked = await sut.invokeTransformFromUrl('testing', navigationInstruction);
assert.strictEqual(hooked, 'hooked:testing', `hooked`);
await tearDown();
});