diff --git a/src/main_thread/decrypt/__tests__/__global__/utils.ts b/src/main_thread/decrypt/__tests__/__global__/utils.ts index 3e27d7eb92f..5c1e23fbf22 100644 --- a/src/main_thread/decrypt/__tests__/__global__/utils.ts +++ b/src/main_thread/decrypt/__tests__/__global__/utils.ts @@ -515,5 +515,11 @@ export function formatFakeChallengeFromInitData( ): Uint8Array { const initDataAB = initData instanceof ArrayBuffer ? initData : initData.buffer; const objChallenge = [initDataType, bytesToBase64(new Uint8Array(initDataAB))]; - return strToUtf8(JSON.stringify(objChallenge)); + let data = strToUtf8(JSON.stringify(objChallenge)); + // Work-around some testing environment issue + // see https://github.com/vitest-dev/vitest/issues/4043 + if (!(data instanceof Uint8Array)) { + data = new Uint8Array(data); + } + return data; } diff --git a/src/parsers/texttracks/ttml/html/__tests__/__global__/html_ttml_parser.test.test.ts b/src/parsers/texttracks/ttml/html/__tests__/__global__/html_ttml_parser.test.ts similarity index 89% rename from src/parsers/texttracks/ttml/html/__tests__/__global__/html_ttml_parser.test.test.ts rename to src/parsers/texttracks/ttml/html/__tests__/__global__/html_ttml_parser.test.ts index ad36a6ecbc7..ef3b19c9922 100644 --- a/src/parsers/texttracks/ttml/html/__tests__/__global__/html_ttml_parser.test.test.ts +++ b/src/parsers/texttracks/ttml/html/__tests__/__global__/html_ttml_parser.test.ts @@ -162,12 +162,24 @@ describe("Global TTML HTML parsing tests", () => { return currTextNodes; } let nbTextNodes = 0; - const textNodes = findTextNodes(res[6].element); - for (let i = 0; i < textNodes.length; i++) { - const parentElement = textNodes[i].parentElement; - if (parentElement !== null) { - expect(globalScope.getComputedStyle(parentElement).color).toEqual("yellow"); - nbTextNodes++; + { + const textNodes = findTextNodes(res[5].element); + for (let i = 0; i < textNodes.length; i++) { + const parentElement = textNodes[i].parentElement; + if (parentElement !== null) { + expect(globalScope.getComputedStyle(parentElement).color).toEqual("yellow"); + nbTextNodes++; + } + } + } + { + const textNodes = findTextNodes(res[6].element); + for (let i = 0; i < textNodes.length; i++) { + const parentElement = textNodes[i].parentElement; + if (parentElement !== null) { + expect(globalScope.getComputedStyle(parentElement).color).toEqual("white"); + nbTextNodes++; + } } } expect(nbTextNodes).toBeGreaterThanOrEqual(1);