Skip to content

Commit

Permalink
assertion text
Browse files Browse the repository at this point in the history
  • Loading branch information
adrums86 committed Jan 23, 2023
1 parent ba64cd1 commit f202a4a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
32 changes: 16 additions & 16 deletions test/mp4-emsg.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@ QUnit.test('Can parse a v0 emsg box', function(assert) {
var boxData = generateEmsgBoxData(0, messageData);
var parsedBox = emsg.parseEmsgBox(boxData);
// we're getting wrong version for some reason
assert.equal(parsedBox.scheme_id_uri, 'urn:foo:bar:2023\0', 'parsed v1 box has expected scheme_id_uri');
assert.equal(parsedBox.value, 'foo.bar.value\0', 'parsed v1 box has expected value');
assert.equal(parsedBox.timescale, 100, 'parsed v1 box has expected timescale');
assert.equal(parsedBox.presentation_time, undefined, 'parsed v1 box has expected presentation_time');
assert.equal(parsedBox.presentation_time_delta, 1000, 'parsed v1 box has expected presentation_time_delta');
assert.equal(parsedBox.event_duration, 0, 'parsed v1 box has expected event_duration');
assert.equal(parsedBox.id, 1, 'parsed v1 box has expected id');
assert.deepEqual(parsedBox.message_data, messageData, 'parsed v1 box has expected data');
assert.equal(parsedBox.scheme_id_uri, 'urn:foo:bar:2023\0', 'v0 box has expected scheme_id_uri');
assert.equal(parsedBox.value, 'foo.bar.value\0', 'v0 box has expected value');
assert.equal(parsedBox.timescale, 100, 'v0 box has expected timescale');
assert.equal(parsedBox.presentation_time, undefined, 'v0 box has expected presentation_time');
assert.equal(parsedBox.presentation_time_delta, 1000, 'v0 box has expected presentation_time_delta');
assert.equal(parsedBox.event_duration, 0, 'v0 box has expected event_duration');
assert.equal(parsedBox.id, 1, 'v0 box has expected id');
assert.deepEqual(parsedBox.message_data, messageData, 'v0 box has expected data');

});

QUnit.test('Can parse a v1 emsg box', function(assert) {
var boxData = generateEmsgBoxData(1, messageData);
var parsedBox = emsg.parseEmsgBox(boxData);
// we're getting wrong version for some reason
assert.equal(parsedBox.scheme_id_uri, 'urn:foo:bar:2023\0', 'parsed v1 box has expected scheme_id_uri');
assert.equal(parsedBox.value, 'foo.bar.value\0', 'parsed v1 box has expected value');
assert.equal(parsedBox.timescale, 100, 'parsed v1 box has expected timescale');
assert.equal(parsedBox.presentation_time, 10000, 'parsed v1 box has expected presentation_time');
assert.equal(parsedBox.presentation_time_delta, undefined, 'parsed v1 box has expected presentation_time_delta');
assert.equal(parsedBox.event_duration, 1, 'parsed v1 box has expected event_duration');
assert.equal(parsedBox.id, 2, 'parsed v1 box has expected id');
assert.deepEqual(parsedBox.message_data, messageData, 'parsed v1 box has expected data');
assert.equal(parsedBox.scheme_id_uri, 'urn:foo:bar:2023\0', 'v1 box has expected scheme_id_uri');
assert.equal(parsedBox.value, 'foo.bar.value\0', 'v1 box has expected value');
assert.equal(parsedBox.timescale, 100, 'v1 box has expected timescale');
assert.equal(parsedBox.presentation_time, 10000, 'v1 box has expected presentation_time');
assert.equal(parsedBox.presentation_time_delta, undefined, 'v1 box has expected presentation_time_delta');
assert.equal(parsedBox.event_duration, 1, 'v1 box has expected event_duration');
assert.equal(parsedBox.id, 2, 'v1 box has expected id');
assert.deepEqual(parsedBox.message_data, messageData, 'v1 box has expected data');

});
12 changes: 6 additions & 6 deletions test/mp4-probe.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ QUnit.test('can get ID3 data from a v1 EMSG box', function(assert) {
var v1EmsgId3Data = mp4Helpers.generateEmsgBoxData(1, id3Data);
var emsgId3Box = new Uint8Array(box('emsg', Array.from(v1EmsgId3Data)));
var emsgBoxes = probe.getEmsgID3(emsgId3Box);
assert.equal(emsgBoxes[0].pts, 100, 'got correct ID3 pts value from v0 emsg');
assert.equal(emsgBoxes[0].duration, 0.01, 'got correct ID3 duration value from v0 emsg');
assert.deepEqual(emsgBoxes[0].data, id3Data, 'got correct ID3 data from v0 emsg');
assert.equal(emsgBoxes[0].pts, 100, 'got correct ID3 pts value from v1 emsg');
assert.equal(emsgBoxes[0].duration, 0.01, 'got correct ID3 duration value from v1 emsg');
assert.deepEqual(emsgBoxes[0].data, id3Data, 'got correct ID3 data from v1 emsg');
});

QUnit.test('can get ID3 data from a multiple EMSG boxes', function(assert) {
Expand All @@ -195,9 +195,9 @@ QUnit.test('can get ID3 data from a multiple EMSG boxes', function(assert) {

var emsgBoxes = probe.getEmsgID3(multiBoxData);

assert.equal(emsgBoxes[0].pts, 100, 'got correct ID3 pts value from v0 emsg');
assert.equal(emsgBoxes[0].duration, 0.01, 'got correct ID3 duration value from v0 emsg');
assert.deepEqual(emsgBoxes[0].data, v1id3Data, 'got correct ID3 data from v0 emsg');
assert.equal(emsgBoxes[0].pts, 100, 'got correct ID3 pts value from v1 emsg');
assert.equal(emsgBoxes[0].duration, 0.01, 'got correct ID3 duration value from v1 emsg');
assert.deepEqual(emsgBoxes[0].data, v1id3Data, 'got correct ID3 data from v1 emsg');

assert.equal(emsgBoxes[1].pts, 10, 'got correct ID3 pts value from v0 emsg');
assert.equal(emsgBoxes[1].duration, 0, 'got correct ID3 duration value from v0 emsg');
Expand Down
8 changes: 4 additions & 4 deletions test/utils.string.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ QUnit.test('Converts a uint8 array into a C string from start of array until fir
var uint8String = new Uint8Array([0x66, 0x6F, 0x6F, 0x2E, 0x62, 0x61, 0x72, 0x2E, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x00,
0x76, 0x61, 0x6C, 0x75, 0x65, 0x2E, 0x62, 0x61, 0x72, 0x00]); // foo.bar.value\0value.bar\0
var firstString = string.uint8ToCString(uint8String);
assert.equal(firstString, 'foo.bar.value\0', 'Converts uint8 data to a c string');
assert.equal(firstString.length, 14, 'String has the correct length');
assert.equal(firstString, 'foo.bar.value\0', 'converts uint8 data to a c string');
assert.equal(firstString.length, 14, 'string has the correct length');
var secondString = string.uint8ToCString(uint8String.subarray(14));
assert.equal(secondString, 'value.bar\0', 'Converts uint8 data to a string');
assert.equal(secondString.length, 10, 'String has the correct length');
assert.equal(secondString, 'value.bar\0', 'converts uint8 data to a c string');
assert.equal(secondString.length, 10, 'string has the correct length');
});

0 comments on commit f202a4a

Please sign in to comment.