aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-04-27 15:06:56 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-04-27 15:07:01 +0200
commit004a0372abd42da19690d95b25ede5b0ffe10601 (patch)
tree88d9a43145d1b0ce742750d2762b387d3d6c7f25
parent07715206e54cab23788e3167e5a77509ffd3e369 (diff)
downloadwallet-core-004a0372abd42da19690d95b25ede5b0ffe10601.tar.xz
get test skeleton working again
-rw-r--r--package.json2
-rw-r--r--test/run_tests.js21
-rw-r--r--test/tests/taler.ts15
3 files changed, 7 insertions, 31 deletions
diff --git a/package.json b/package.json
index e36b22776..7aaeaff26 100644
--- a/package.json
+++ b/package.json
@@ -28,7 +28,7 @@
"gulp-zip": "^3.1.0",
"jed": "^1.1.0",
"map-stream": "0.0.6",
- "mocha": "^2.3.4",
+ "mocha": "^2.4.5",
"po2json": "git+https://github.com/mikeedwards/po2json",
"systemjs": "^0.19.14",
"through2": "^2.0.1",
diff --git a/test/run_tests.js b/test/run_tests.js
index f62810f7e..f6a623942 100644
--- a/test/run_tests.js
+++ b/test/run_tests.js
@@ -18,38 +18,25 @@ if ("function" !== typeof run) {
throw Error("test must be run with 'mocha --delay ...'");
}
-console.log("typeof require (here)", typeof require);
+let emsc = require("../lib/emscripten/libwrapper.js");
-// We might need thins in the future ...
-global.nodeRequire = function (modulePath) {
- return require(modulePath);
-};
-
-global.require = global.nodeRequire;
-
-let data = fs.readFileSync("lib/emscripten/libwrapper.js");
-vm.runInThisContext(data);
-
-// Do it here, since it breaks 'require''
+// Do it here, since it breaks 'require'' for libwrapper
let System = require("systemjs");
System.config({
defaultJSExtensions: true
});
-let mod = System.newModule({Module: Module});
+let mod = System.newModule({Module: emsc});
let modName = System.normalizeSync(__dirname + "/../lib/emscripten/emsc");
console.log("registering", modName);
System.set(modName, mod);
-
System.import("./test/tests/taler.js")
.then((t) => {
t.declareTests(assert, context, it);
- run();
+ setTimeout(run, 1);
})
.catch((e) => {
console.error("failed to load module", e.stack);
});
-
-
diff --git a/test/tests/taler.ts b/test/tests/taler.ts
index 14130f9af..941e8284d 100644
--- a/test/tests/taler.ts
+++ b/test/tests/taler.ts
@@ -5,20 +5,9 @@ declare var HttpMockLib;
export function declareTests(assert, context, it) {
- it("works!", function() {
+ it("calls native emscripten code", function() {
let x = new Emsc.Amount({value: 42, fraction: 42, currency: "EUR"});
let j = x.toJson();
assert("value" in j);
});
-
-
- it("retries", function() {
- let m = new HttpMockLib();
- /*m.intercept()
- .matchUrlContains()
- .counterEquals(0)
- .count()
- .sen*/
- })
-
-} \ No newline at end of file
+}