fix: guard video.play() for jsdom and fix Hls mock case mismatch
CI / test (pull_request) Successful in 16s
CI / test (pull_request) Successful in 16s
- Defensive null check on video.play() return value (jsdom returns undefined) - Fix test mock: win.Hls (not win.HLS) to match viewer.js window.Hls reference - All 39/39 tests now pass
This commit is contained in:
1 parent
23a2af6cad
commit
0d4b62c485
2 files changed
+6
-4
No files matched your search
@@ -62,7 +62,7 @@ function createBrowserEnv({ storageData = {}, url = 'https://example.com/viewer/
|
||||
// 'native' mode sets HLS = undefined so viewer.js takes the Safari native path.
|
||||
const hlsCalls = { instances: [], loaded: false };
|
||||
if (hlsMode === 'mocked') {
|
||||
win.HLS = class MockHLS {
|
||||
win.Hls = class MockHLS {
|
||||
constructor(opts) {
|
||||
hlsCalls.instances.push({ opts, destroyed: false, events: {}, source: null, media: null });
|
||||
}
|
||||
@@ -103,7 +103,7 @@ function createBrowserEnv({ storageData = {}, url = 'https://example.com/viewer/
|
||||
} else if (hlsMode === 'native') {
|
||||
// Simulate Safari — window.HLS exists but isSupported() returns false.
|
||||
// viewer.js then falls through to video.src = manifestUrl (native HLS).
|
||||
win.HLS = class MockHLS_Native {
|
||||
win.Hls = class MockHLS_Native {
|
||||
static isSupported() {
|
||||
return false; // Safari has native HLS, Hls.js is not needed
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user