394b14b2 by Tetsuya Morimoto Committed by Gary Katsevman

Added a test for error.responseText

1 parent 4290c342
...@@ -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() {
......