-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
33 lines (27 loc) · 922 Bytes
/
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
/*!
* helper-coverage <https://github.com/jonschlinkert/helper-coverage>
*
* Copyright (c) 2015 Jon Schlinkert.
* Licensed under the MIT license.
*/
'use strict';
require('mocha');
require('should');
var fs = require('fs');
var handlebars = require('handlebars');
var coverage = require('./');
var expected = fs.readFileSync('fixtures/expected.txt', 'utf8');
describe('coverage', function() {
it('should include a formatted coverage report:', function() {
coverage('fixtures/summary.txt').should.equal(expected);
});
it('should work as a handlebars helper:', function() {
handlebars.registerHelper('coverage', coverage);
handlebars.compile('{{coverage "fixtures/summary.txt"}}')().should.equal(expected);
});
it('should throw an error when the file cannot be found:', function() {
(function() {
coverage('foo');
}).should.throw('helper-coverage cannot find: foo');
});
});