1 /* Copyright (c) 2013 IndexData ApS. http://indexdata.com
6 describe("Asynchronous check", function () {
7 it("contains spec with an expectation", function () {
8 expect(true).toBe(true);
12 it("simple check", function () {
16 function found(time, none) {
17 setTimeout(function () {
23 // check hit counter after N seconds
32 waitsFor(function () {
33 // console.log("waits for ... " + timer);
34 return timer == max_time ? true : false;
35 }, "The Value should be N seconds", max_time * 1000);
38 expect(timer).toEqual(max_time);
43 it("double async check", function () {
47 function found(time, none) {
48 setTimeout(function () {
56 found(max_time - 0.1);
59 waitsFor(function () {
60 return timer == max_time - 0.1 ? true : false;
61 }, "The Value should be N seconds", max_time * 1000);
64 expect(timer <= max_time).toBeTruthy();
73 waitsFor(function () {
74 // console.log("waits for ... " + timer);
75 return timer == max_time ? true : false;
76 }, "The Value should be N seconds", max_time * 1000);
79 expect(timer <= max_time).toBeTruthy();