-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
67 lines (60 loc) · 3.04 KB
/
test.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
'use strict';
var assert = require('assert');
var fs = require('fs');
var rimraf = require('rimraf');
var debug = require('debug')('broccoli:docco:test');
// cleanup after testing
after(function () {
// remove the Broccoli temporary directory (in case it hasn't done this itself)
rimraf.sync('tmp'); // the broccoli temporary directory
// remove the directory that `broccoli build` targets
rimraf.sync('temp');
});
// JavaScript
it('should create documentation for Javascript source', function () {
var expected = './temp/docs/testJS.html';
var actual = fs.readdirSync('temp');
assert(fs.existsSync(expected), "JS documentation should exist! Documentation files that did exist included: " + JSON.stringify(actual));
var jsDocumentation = fs.readFileSync(expected);
assert.notEqual(jsDocumentation,null,"JS documentation should not be empty");
});
// Coffeescript
it('should create documentation for Coffeescript source', function () {
var expected = './temp/docs/testCoffee.html';
var actual = fs.readdirSync('temp');
assert(fs.existsSync(expected), "Coffee documentation should exist! Documentation files that did exist included: " + JSON.stringify(actual));
var coffeeDocumentation = fs.readFileSync(expected);
assert.notEqual(coffeeDocumentation,null,"Coffee documentation should not be empty");
});
// PHP
it('should create documentation for PHP source', function () {
var expected = './temp/docs/testPHP.html';
var actual = fs.readdirSync('temp');
assert(fs.existsSync(expected), "PHP documentation should exist! Documentation files that did exist included: " + JSON.stringify(actual));
var phpDocumentation = fs.readFileSync(expected);
assert.notEqual(phpDocumentation,null,"PHP documentation should not be empty");
});
// Subfolder
it('should create documentation for source that\'s in a subfolder', function () {
var expected = './temp/docs/testSubFolder.html';
var actual = fs.readdirSync('temp');
assert(fs.existsSync(expected), "JS documentation for a subfolder should exist! Documentation files that did exist included: " + JSON.stringify(actual));
var jsDocumentation = fs.readFileSync(expected);
assert.notEqual(jsDocumentation,null,"JS documentation should not be empty");
});
// Brocfile
it('should create documentation for Brocfile', function () {
var expected = './temp/docs/Brocfile.html';
var actual = fs.readdirSync('temp');
assert(fs.existsSync(expected), "Brocfile documentation should exist! Documentation files that did exist included: " + JSON.stringify(actual));
var jsDocumentation = fs.readFileSync(expected);
assert.notEqual(jsDocumentation,null,"JS documentation should not be empty");
});
// No source remenants
it('none of the source files should exist in the output tree', function () {
var expected = './temp/docs/Brocfile.js';
var actual = fs.readdirSync('temp');
assert.notEqual(fs.existsSync(expected), "Source files should NOT exist in output tree: " + JSON.stringify(actual));
expected = './temp/docs/testJS.js';
assert.notEqual(fs.existsSync(expected), "Source files should NOT exist in output tree: " + JSON.stringify(actual));
});