-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.js
More file actions
66 lines (54 loc) · 2.62 KB
/
tests.js
File metadata and controls
66 lines (54 loc) · 2.62 KB
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
var assert = require("chai").assert,
specs = require("fs").readFileSync("./public/spec/calculator.spec.js", "utf8");
describe("Step 1", function () {
it("Add has enough specs", function () {
assert.property(global.reporter.suites, "Add");
assert.equal(global.reporter.suites["Add"].getTotal(), 2, "Expected 2 specs");
});
it("Add has no failures", function () {
assert.property(global.reporter.suites, "Add");
assert.equal(global.reporter.suites["Add"].failures, 0, "The 'Add' spec failed");
});
it("Jasmine spec includes 'calculator.add'", function () {
assert.notEqual(specs.indexOf("calculator.add"), -1, "calculator.spec did not include 'calculator.add'");
});
});
describe("Step 2", function () {
it("Substract has enough specs", function () {
assert.property(global.reporter.suites, "Substract");
assert.equal(global.reporter.suites["Substract"].getTotal(), 2, "Expected 2 specs");
});
it("Substract has no failures", function () {
assert.property(global.reporter.suites, "Substract");
assert.equal(global.reporter.suites["Substract"].failures, 0, "The 'Substract' spec failed");
});
it("Jasmine spec includes 'calculator.substract'", function () {
assert.notEqual(specs.indexOf("calculator.substract"), -1, "calculator.spec did not include 'calculator.substract'");
});
});
describe("Step 3", function () {
it("Square has enough specs", function () {
assert.property(global.reporter.suites, "Square");
assert.equal(global.reporter.suites["Square"].getTotal(), 4, "Expected 4 specs");
});
it("Square has no failures", function () {
assert.property(global.reporter.suites, "Square");
assert.equal(global.reporter.suites["Square"].failures, 0, "The 'Square' spec failed");
});
it("Jasmine spec includes 'toBeSquareOf:'", function () {
assert.notEqual(specs.indexOf("toBeSquareOf:"), -1, "calculator.spec did not include 'toBeSquareOf:'");
});
});
describe("Step 4", function () {
it("Collatz has enough specs", function () {
assert.property(global.reporter.suites, "Collatz");
assert.equal(global.reporter.suites["Collatz"].getTotal(), 2, "Expected 2 specs");
});
it("Collatz has no failures", function () {
assert.property(global.reporter.suites, "Collatz");
assert.equal(global.reporter.suites["Collatz"].failures, 0, "The 'Collatz' spec failed");
});
it("Jasmine spec includes 'spyOn'", function () {
assert.notEqual(specs.indexOf("spyOn"), -1, "calculator.spec did not include 'spyOn'");
});
});