Skip to content

Commit c5fb607

Browse files
author
Cameron Cundiff
committed
Update tests for logging and auditor
1 parent 4b0f346 commit c5fb607

File tree

6 files changed

+32
-13
lines changed

6 files changed

+32
-13
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ node_js:
44
- stable
55
before_script:
66
- npm install -g gulp
7+
script: gulp
78
notifications:
89
email: false

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://travis-ci.org/accesslint/monitor.svg)](https://travis-ci.org/accesslint/monitor)
1+
[![Build Status](https://travis-ci.org/accesslint/accesslint.js.svg)](https://travis-ci.org/accesslint/accesslint.js)
22

33
# Accessibility Monitoring for Your Website
44

karma.conf.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module.exports = function(config) {
55
"mocha",
66
],
77
files: [
8+
"test/integration/index.html",
89
"test/*_test.js",
910
"test/**/*_test.js",
1011
],
@@ -56,5 +57,8 @@ module.exports = function(config) {
5657
browsers: ["PhantomJS"],
5758
singleRun: false,
5859
concurrency: Infinity,
60+
client: {
61+
captureConsole: false
62+
}
5963
});
6064
};

test/integration/app.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,4 @@ app.get("/", function(req, res) {
1111
res.send("index.html");
1212
});
1313

14-
app.post("/accesslint", function(req, res) {
15-
res.send(req.body);
16-
});
17-
1814
app.listen(3000);

test/integration/public/index.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<html>
2-
<head>
3-
<script src="accesslint.js"></script>
4-
</head>
52
<body>
63
<img src="image.jpg" />
4+
<script src="accesslint.js"></script>
75
</body>
86
</html>

test/unit/auditor_test.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,36 @@ let chai = require("chai");
44
let sinon = require("sinon");
55
let sinonChai = require("sinon-chai");
66
chai.use(sinonChai);
7+
let expect = chai.expect;
78

89
import auditor from "../../src/auditor";
10+
import report from "../../src/reporter";
911

10-
describe("default", () => {
12+
describe("auditor", () => {
1113
it("runs axe-core tests", () => {
12-
let axeSpy = sinon.spy();
13-
window.axe = { a11yCheck: axeSpy };
14+
let axe = sinon.spy();
15+
window.axe = { a11yCheck: axe };
1416

15-
auditor();
17+
auditor(document);
1618

17-
chai.expect(axeSpy).to.be.have.been.called;
19+
expect(axe).to.have.been.called;
20+
});
21+
});
22+
23+
describe("report", () => {
24+
it("logs violations", () => {
25+
let results = {
26+
violations: [{
27+
description: "description",
28+
help: "help",
29+
impact: "impact",
30+
nodes: []
31+
}]
32+
};
33+
sinon.spy(console, "warn");
34+
35+
report(results);
36+
37+
expect(console.warn).to.have.been.called.once;
1838
});
1939
});

0 commit comments

Comments
 (0)