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 () {
20 expect(time >= 0).toBeTruthy();
24 // check hit counter after N seconds
33 waitsFor(function () {
34 // console.log("waits for ... " + timer);
35 return timer == max_time ? true : false;
36 }, "The Value should be N seconds", max_time * 1000);
39 expect(timer).toEqual(max_time);
44 it("double async check", function () {
48 function found(time, none) {
49 setTimeout(function () {
52 expect(time >= 0).toBeTruthy();
58 found(max_time - 0.1);
61 waitsFor(function () {
62 return timer == max_time - 0.1 ? true : false;
63 }, "The Value should be N seconds", max_time * 1000);
66 expect(timer <= max_time).toBeTruthy();
75 waitsFor(function () {
76 // console.log("waits for ... " + timer);
77 return timer == max_time ? true : false;
78 }, "The Value should be N seconds", max_time * 1000);
81 expect(timer <= max_time).toBeTruthy();