-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test when data to parse is equal to null
- Loading branch information
Showing
1 changed file
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
|
||
}); |