aboutsummaryrefslogtreecommitdiff
path: root/testlib
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-11-14 01:29:08 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-11-14 01:29:08 +0100
commit4df35bdcd9e57452bb7f5f5b73f9e52f3693a78f (patch)
tree6b135fe557438b7d77aa4f6400c1f4686c43fdd6 /testlib
parent3d79aba854ccdbc79e8b7145ca99d6e0803e66bc (diff)
downloadwallet-core-4df35bdcd9e57452bb7f5f5b73f9e52f3693a78f.tar.xz
add test for base url canonicalization and fix canonicalization bug
Diffstat (limited to 'testlib')
-rw-r--r--testlib/selenium/testhost.html2
-rw-r--r--testlib/talertest.ts12
2 files changed, 13 insertions, 1 deletions
diff --git a/testlib/selenium/testhost.html b/testlib/selenium/testhost.html
index fcc9394f2..01641547d 100644
--- a/testlib/selenium/testhost.html
+++ b/testlib/selenium/testhost.html
@@ -7,6 +7,8 @@
<script src="/testlib/selenium/escodegen.browser.js"></script>
<script src="/testlib/selenium/instrumenter.js"></script>
+ <script src="/src/vendor/URI.js"></script>
+
<!-- for instrumentation to work, we have to use the non-csp version -->
<script src="/testlib/selenium/system.js"></script>
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));
});