diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-04-27 16:58:17 +0200 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-04-27 16:58:17 +0200 |
commit | eae096e609a2478fb606309b6634f11b614a6866 (patch) | |
tree | 268f76fe196048d2cb583758f9949b21e78275b3 /test | |
parent | 5ea6f8dd00266e1b5cf76826f54364119a295948 (diff) | |
parent | 97f3911c93c841f089f705e7edcef6a6bec45f2e (diff) |
Merge branch 'master' of ssh://taler.net/var/git/wallet-webex
Diffstat (limited to 'test')
-rw-r--r-- | test/run_tests.js | 36 | ||||
-rw-r--r-- | test/tests/taler.ts | 15 |
2 files changed, 19 insertions, 32 deletions
diff --git a/test/run_tests.js b/test/run_tests.js index f62810f7e..88aded741 100644 --- a/test/run_tests.js +++ b/test/run_tests.js @@ -12,44 +12,42 @@ let assert = require("better-assert"); let vm = require("vm"); let fs = require("fs"); - +let instrument = require("typhonjs-istanbul-instrument-jspm").default; if ("function" !== typeof run) { throw Error("test must be run with 'mocha --delay ...'"); } -console.log("typeof require (here)", typeof require); - -// We might need thins in the future ... -global.nodeRequire = function (modulePath) { - return require(modulePath); -}; - -global.require = global.nodeRequire; +let emsc = require("../lib/emscripten/libwrapper.js"); -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 + defaultJSExtensions: true, + meta: { + './test/tests/taler.js': { + format: 'register' + }, + './lib/wallet/*': { + format: 'register' + } + } }); -let mod = System.newModule({Module: Module}); +instrument(System); + +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 +} |