From 78f2b58ca1297707fc5091e1acc62c42ac83e141 Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Wed, 5 Nov 2014 11:11:45 +0100 Subject: [PATCH] don't run async.spec.js by default This test may fail under high load due exact timer checks. We don't need this test, it is a demo / proof of concept. --- test/spec-dev/async.spec.js | 85 +++++++++++++++++++++++++++++++++++++++++++ test/spec/async.spec.js | 85 ------------------------------------------- 2 files changed, 85 insertions(+), 85 deletions(-) create mode 100644 test/spec-dev/async.spec.js delete mode 100644 test/spec/async.spec.js diff --git a/test/spec-dev/async.spec.js b/test/spec-dev/async.spec.js new file mode 100644 index 0000000..6de372d --- /dev/null +++ b/test/spec-dev/async.spec.js @@ -0,0 +1,85 @@ +/* Copyright (c) 2013 Index Data ApS. http://indexdata.com + * + * async check + * + */ +describe("Asynchronous check", function () { + it("contains spec with an expectation", function () { + expect(true).toBe(true); + }); + + // Asynchronous part + it("simple check", function () { + var max_time = 1; + var timer = 0; + + function found(time, none) { + setTimeout(function () { + timer = time; + }, time * 1000); + expect(time >= 0).toBeTruthy(); + } + + runs(function () { + // check hit counter after N seconds + found(0, true); + found(0.2); + found(0.4); + found(0.5); + found(0.7); + found(max_time); + }); + + waitsFor(function () { + // console.log("waits for ... " + timer); + return timer == max_time ? true : false; + }, "The Value should be N seconds", max_time * 1000); + + runs(function () { + expect(timer).toEqual(max_time); + }); + }); + + + it("double async check", function () { + var max_time = 0.5; + var timer = 0; + + function found(time, none) { + setTimeout(function () { + timer = time; + }, time * 1000); + expect(time >= 0).toBeTruthy(); + } + + runs(function () { + found(0); + found(0.2); + found(max_time - 0.1); + }); + + waitsFor(function () { + return timer == max_time - 0.1 ? true : false; + }, "The Value should be N seconds", max_time * 1000); + + runs(function () { + expect(timer <= max_time).toBeTruthy(); + }); + + timer = 0; + runs(function () { + found(0.1); + found(max_time); + }); + + waitsFor(function () { + // console.log("waits for ... " + timer); + return timer == max_time ? true : false; + }, "The Value should be N seconds", max_time * 1000); + + runs(function () { + expect(timer <= max_time).toBeTruthy(); + }); + }); + +}); diff --git a/test/spec/async.spec.js b/test/spec/async.spec.js deleted file mode 100644 index 6de372d..0000000 --- a/test/spec/async.spec.js +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (c) 2013 Index Data ApS. http://indexdata.com - * - * async check - * - */ -describe("Asynchronous check", function () { - it("contains spec with an expectation", function () { - expect(true).toBe(true); - }); - - // Asynchronous part - it("simple check", function () { - var max_time = 1; - var timer = 0; - - function found(time, none) { - setTimeout(function () { - timer = time; - }, time * 1000); - expect(time >= 0).toBeTruthy(); - } - - runs(function () { - // check hit counter after N seconds - found(0, true); - found(0.2); - found(0.4); - found(0.5); - found(0.7); - found(max_time); - }); - - waitsFor(function () { - // console.log("waits for ... " + timer); - return timer == max_time ? true : false; - }, "The Value should be N seconds", max_time * 1000); - - runs(function () { - expect(timer).toEqual(max_time); - }); - }); - - - it("double async check", function () { - var max_time = 0.5; - var timer = 0; - - function found(time, none) { - setTimeout(function () { - timer = time; - }, time * 1000); - expect(time >= 0).toBeTruthy(); - } - - runs(function () { - found(0); - found(0.2); - found(max_time - 0.1); - }); - - waitsFor(function () { - return timer == max_time - 0.1 ? true : false; - }, "The Value should be N seconds", max_time * 1000); - - runs(function () { - expect(timer <= max_time).toBeTruthy(); - }); - - timer = 0; - runs(function () { - found(0.1); - found(max_time); - }); - - waitsFor(function () { - // console.log("waits for ... " + timer); - return timer == max_time ? true : false; - }, "The Value should be N seconds", max_time * 1000); - - runs(function () { - expect(timer <= max_time).toBeTruthy(); - }); - }); - -}); -- 1.7.10.4