-
Notifications
You must be signed in to change notification settings - Fork 4
/
intro.js
112 lines (106 loc) · 2.8 KB
/
intro.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// Generated by CoffeeScript 1.3.3
(function() {
describe("Test Suite", function() {
return it("has expectations", function() {
return expect(1 + 2).toBe(3);
});
});
describe("Disabled", function() {
xdescribe("disabled suite", function() {
return it("will not run, since the suite has been disabled", function() {
return expect(true).toBe(true);
});
});
return xit("disabled test", function() {
return expect(true).toBe(true);
});
});
describe("Matchers", function() {
it("compares using ===", function() {
return expect(1 + 2).toBe(3);
});
it("compares variables and objects (including content)", function() {
var a, b;
a = {
x: 8,
y: 9
};
b = {
x: 8,
y: 9
};
expect(a).toEqual(b);
return expect(a).not.toBe(b);
});
it("checks value to be defined", function() {
return expect(window.document).toBeDefined();
});
it("checks value to be undefined", function() {
return expect(window.notExists).toBeUndefined();
});
it("checks value to be null", function() {
var a;
a = null;
return expect(a).toBeNull();
});
it("checks value to be true", function() {
return expect(5 > 0).toBeTruthy();
});
it("checks value to be false", function() {
return expect(5 < 0).toBeFalsy();
});
it("checks value to be less than", function() {
return expect(1 + 2).toBeLessThan(5);
});
it("checks value to be greater than", function() {
return expect(1 + 2).toBeGreaterThan(0);
});
it("checks value to be close to", function() {
return expect(1.2345).toBeCloseTo(1.2, 1);
});
it("checks RegEx match", function() {
return expect("some string").toMatch(/string/);
});
it("checks inclusion", function() {
expect([1, 2, 3]).toContain(2);
return expect("some string").toContain("some");
});
return it("throws exception", function() {
var func;
func = function() {
return window.notExists.value;
};
return expect(func).toThrow();
});
});
describe("Setup/Teardown", function() {
var a;
a = 0;
beforeEach(function() {
return a += 1;
});
afterEach(function() {
return a = 0;
});
return it("uses val", function() {
return expect(a).toEqual(1);
});
});
describe("Asynchronous", function() {
var a, async;
a = 0;
async = function() {
return setTimeout((function() {
return a = 5;
}), 1000);
};
return it("async executes code", function() {
runs(function() {
return async();
});
return waitsFor((function() {
return a === 5;
}), "the value should be changed", 3000);
});
});
}).call(this);