diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-11-14 01:29:08 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-11-14 01:29:08 +0100 |
commit | 4df35bdcd9e57452bb7f5f5b73f9e52f3693a78f (patch) | |
tree | 6b135fe557438b7d77aa4f6400c1f4686c43fdd6 /testlib/talertest.ts | |
parent | 3d79aba854ccdbc79e8b7145ca99d6e0803e66bc (diff) |
add test for base url canonicalization and fix canonicalization bug
Diffstat (limited to 'testlib/talertest.ts')
-rw-r--r-- | testlib/talertest.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/testlib/talertest.ts b/testlib/talertest.ts index 6012eb657..b602fca14 100644 --- a/testlib/talertest.ts +++ b/testlib/talertest.ts @@ -30,6 +30,7 @@ export interface TestLib { pass(msg?: string): void; fail(msg?: string): void; assert(v: any, msg?: string): void; + assertEqualsStrict(v1: any, v2: any, msg?: string): void; } let tests: Test[] = []; @@ -75,8 +76,17 @@ export async function run(statusCallback?: (m: string) => void) { throw Error("test failed"); } }; + let assertEqualsStrict = (v1: any, v2: any, msg?: string) => { + if (v1 !== v2) { + console.log(`# expected: ${v1}`); + console.log(`# actual: ${v2}`); + lastMsg = msg; + reject(); + throw Error("test failed"); + } + }; // Test might return a promise. If so, wait for it. - let r = t.testFn({pass,fail, assert}); + let r = t.testFn({pass,fail, assert, assertEqualsStrict}); r.then(() => resolve(), (e) => reject(e)); }); |