Skip to content

Commit

Permalink
update unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nfrederiksen committed Aug 8, 2023
1 parent fc4615f commit b21fc10
Show file tree
Hide file tree
Showing 9 changed files with 3,721 additions and 701 deletions.
26 changes: 26 additions & 0 deletions spec/hlsvod_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,9 @@ describe("HLSVod with not equal usage profiles", () => {
mockMasterManifest.push(function () {
return fs.createReadStream("testvectors/hls_abr4/master.m3u8");
});
mockMasterManifest.push(function () {
return fs.createReadStream("testvectors/hls_abr6/master.m3u8");
})
mockMediaManifest.push(function (bandwidth) {
return fs.createReadStream("testvectors/hls1/" + bandwidth + ".m3u8");
});
Expand All @@ -910,6 +913,9 @@ describe("HLSVod with not equal usage profiles", () => {
mockMediaManifest.push(function (bandwidth) {
return fs.createReadStream("testvectors/hls_abr4/" + bandwidth + ".m3u8");
});
mockMediaManifest.push(function (bandwidth) {
return fs.createReadStream("testvectors/hls_abr6/" + bandwidth + ".m3u8");
});
});

it("can find a correct match", (done) => {
Expand Down Expand Up @@ -1200,6 +1206,26 @@ describe("HLSVod with not equal usage profiles", () => {
done();
});
});

it("can match by true nearest when options-> alwaysMapBandwidthByNearest is true", (done) => {
mockVod = new HLSVod("http://mock.com/mock.m3u8", null, 0,0, null, { alwaysMapBandwidthByNearest: 1 });
mockVod2 = new HLSVod("http://mock.com/mock2.m3u8", null, 0,0, null, { alwaysMapBandwidthByNearest: 1 });
mockVod
.load(mockMasterManifest[0], mockMediaManifest[0])
.then(() => {
return mockVod2.loadAfter(mockVod, mockMasterManifest[7], mockMediaManifest[7]);
})
.then(() => {
const seqSegments = mockVod2.getLiveMediaSequenceSegments(0);
const lastIdx = seqSegments["1497000"].length - 1;
expect(seqSegments["1497000"][lastIdx].uri).toEqual("https://mock.vod.media/segment1_0_av.ts");
expect(seqSegments["3496000"][lastIdx].uri).toEqual("https://mock.vod.media/segment1_1_av.ts");
expect(seqSegments["4497000"][lastIdx].uri).toEqual("https://mock.vod.media/segment1_2_av.ts");
expect(seqSegments["5544000"][lastIdx].uri).toEqual("https://mock.vod.media/segment1_3_av.ts");
expect(seqSegments["6655000"][lastIdx].uri).toEqual("https://mock.vod.media/segment1_4_av.ts");
done();
});
});
});
/**
* Changes:
Expand Down
Loading

0 comments on commit b21fc10

Please sign in to comment.