UNPKG

1.33 kBJavaScriptView Raw
1/**
2 * @fileoverview NodeUnit test
3 * @copyright Bertrand Chevrier 2012
4 * @author Bertrand Chevrier <chevrier.bertrand@gmail.com>
5 * @license MIT
6 *
7 * @module test/jsdoc-task
8 */
9
10var fs = require('fs');
11
12
13/**
14 * NodeUnit group of test that check the result once the task has been launched
15 *
16 * @see https://github.com/caolan/nodeunit/
17 *
18 * @class JsdocTaskTest
19 */
20var JsdocTaskTest = {
21
22 /**
23 * Check the destination directory exists
24 * @memberOf JsdociTaskTest
25 * @param {Object} test - the node unit test context
26 */
27 'destination check': function(test) {
28 'use strict';
29
30 test.expect(1);
31
32 fs.exists(this.destination, function(result) {
33 test.ok(result === true, 'The documentation destination should exists');
34 test.done();
35 });
36 },
37
38 /**
39 * Check the documentation content
40 * @memberOf JsdociTaskTest
41 * @param {Object} test - the node unit test context
42 */
43 'content check': function(test) {
44
45 var base = this.destination + '/';
46
47 test.expect(this.expectedFiles.length);
48
49 this.expectedFiles.forEach(function(file) {
50 test.ok(fs.existsSync(base + file), 'The file ' + base + file + ' should exists');
51 });
52 test.done();
53 }
54
55};
56
57module.exports = exports = JsdocTaskTest;
58