Added a test for error.responseText
Showing
1 changed file
with
3 additions
and
1 deletions
... | @@ -240,6 +240,7 @@ | ... | @@ -240,6 +240,7 @@ |
240 | test('emits an error if a media refresh fails', function() { | 240 | test('emits an error if a media refresh fails', function() { |
241 | var | 241 | var |
242 | errors = 0, | 242 | errors = 0, |
243 | errorResponseText = 'custom error message', | ||
243 | loader = new videojs.Hls.PlaylistLoader('live.m3u8'); | 244 | loader = new videojs.Hls.PlaylistLoader('live.m3u8'); |
244 | 245 | ||
245 | loader.on('error', function() { | 246 | loader.on('error', function() { |
... | @@ -251,10 +252,11 @@ | ... | @@ -251,10 +252,11 @@ |
251 | '#EXTINF:10,\n' + | 252 | '#EXTINF:10,\n' + |
252 | '0.ts\n'); | 253 | '0.ts\n'); |
253 | clock.tick(10 * 1000); // trigger a refresh | 254 | clock.tick(10 * 1000); // trigger a refresh |
254 | requests.pop().respond(500); | 255 | requests.pop().respond(500, null, errorResponseText); |
255 | 256 | ||
256 | strictEqual(errors, 1, 'emitted an error'); | 257 | strictEqual(errors, 1, 'emitted an error'); |
257 | strictEqual(loader.error.status, 500, 'captured the status code'); | 258 | strictEqual(loader.error.status, 500, 'captured the status code'); |
259 | strictEqual(loader.error.responseText, errorResponseText, 'captured the responseText'); | ||
258 | }); | 260 | }); |
259 | 261 | ||
260 | test('switches media playlists when requested', function() { | 262 | test('switches media playlists when requested', function() { | ... | ... |
-
Please register or sign in to post a comment