Skip to content

Commit

Permalink
add test when data to parse is equal to null
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosang committed Sep 1, 2017
1 parent 3fb6e22 commit 1844838
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion test/unit/dash.DashParser.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
import DashParser from '../../src/dash/parser/DashParser';

import ErrorHandlerMock from './mocks/ErrorHandlerMock';
const expect = require('chai').expect;

const context = {};
const dashParser = DashParser(context).create({});
let dashParser = DashParser(context).create({});

describe('DashParser', function () {

beforeEach(function () {
if (typeof window === 'undefined') {
global.window = {
performance: {
now: function () {
return Date.now();
}
}
};
}
});

afterEach(function () {
delete global.window;
});

it('should throw an error when parse is called and config object has not been set properly', function () {
expect(dashParser.parse.bind('')).to.be.throw('Missing config parameter(s)');
});

it('should throw an error when parse is called without data and config object has been set properly', function () {
let errorHandlerMock = new ErrorHandlerMock();
dashParser = DashParser(context).create({errorHandler: errorHandlerMock});
dashParser.parse();
expect(errorHandlerMock.error).to.equal('parsing the manifest failed');
});

});

0 comments on commit 1844838

Please sign in to comment.