1 | (function (util, parser, helper) {
|
2 | 'use strict';
|
3 |
|
4 | var expect = helper.chai.expect;
|
5 | var validFormats = ['lcov'];
|
6 |
|
7 | describe('Coverage Parser', function () {
|
8 | it('should receive an error when trying to use an unsupported format', function () {
|
9 | expect(function () {
|
10 | parser.getParser('invalid-format');
|
11 | }).to.throw(Error, util.format('Expected one of the following supported formats: %j, but got [%s]', validFormats, 'invalid-format'));
|
12 | });
|
13 |
|
14 | validFormats.forEach(function (format) {
|
15 | it('should be able to instantiate the parser for ' + format, function () {
|
16 | expect(function () {
|
17 | parser.getParser(format);
|
18 | }).to.not.throw();
|
19 | });
|
20 | it('shouldn\'t be able to parse a blank coverage file for ' + format, function () {
|
21 | return expect(parser.getParser(format).parse('')).to.eventually.be.rejectedWith(Error, '"value" is required');
|
22 | });
|
23 | it('shouldn\'t be able to parse invalid coverage for ' + format, function () {
|
24 | return expect(parser.getParser(format).parse('', 'There is no Dana, only Zuul')).to.eventually.be.rejectedWith(Error, 'Failed to parse string');
|
25 | });
|
26 | it('shouldn\'t be able to parse a non-existent coverage file for ' + format, function () {
|
27 | return expect(parser.getParser(format).parse('', '/no-exist/lcov')).to.eventually.be.rejectedWith(Error, 'Failed to parse string');
|
28 | });
|
29 | });
|
30 | });
|
31 | }(require('util'), require('../lib/coverageParser'), require('./helper'))); |
\ | No newline at end of file |