Skip to content

Commit

Permalink
chore: coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
adrums86 committed Oct 18, 2024
1 parent 26561d6 commit b934e79
Showing 1 changed file with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions test/transmuxer-worker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,16 +427,43 @@ QUnit.test('returns empty webVttCues array if segment is empty', function(assert
const done = assert.async();
const initSegment = webVttInit();
const segment = new Uint8Array();
const secondSegment = webVttSegment();
let callCount = 0;

this.transmuxer = createTransmuxer();
this.transmuxer.onmessage = (e) => {
const message = e.data;
const expectedCues = [];

assert.equal(message.action, 'getMp4WebVttText', 'returned getMp4WebVttText event');
assert.deepEqual(message.mp4VttCues, expectedCues, 'mp4 vtt cues are expected values');

done();
callCount++;
if (callCount === 2) {
const secondExpectedCues = [
{
cueText: '2024-10-16T05:13:50Z\nen # 864527815',
end: 1729055630.9,
settings: undefined,
start: 1729055630
},
{
cueText: '2024-10-16T05:13:51Z\nen # 864527815',
end: 1729055631.9,
settings: undefined,
start: 1729055631
}
];

assert.deepEqual(message.mp4VttCues, secondExpectedCues, 'mp4 vtt cues are expected values');
done();
} else {
const expectedCues = [];

assert.equal(message.action, 'getMp4WebVttText', 'returned getMp4WebVttText event');
assert.deepEqual(message.mp4VttCues, expectedCues, 'mp4 vtt cues are expected values');

this.transmuxer.postMessage({
action: 'getMp4WebVttText',
data: secondSegment
});
}
};

this.transmuxer.postMessage({
Expand Down

0 comments on commit b934e79

Please sign in to comment.