mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Update Jasmine to version 4
For the unit-tests that were updated in this patch, note that I settled on simply using `toEqual` comparisons rather than updating the custom matchers (since those don't seem necessary any more). Please refer to the following resources for additional information: - https://github.com/jasmine/jasmine/blob/main/release_notes/4.0.0.md - https://github.com/jasmine/jasmine-npm/blob/main/release_notes/4.0.0.md - https://jasmine.github.io/tutorials/upgrading_to_Jasmine_4.0
This commit is contained in:
parent
38e574f1d5
commit
457ff0d54a
5 changed files with 89 additions and 171 deletions
|
@ -18,36 +18,6 @@ import { PredictorStream } from "../../src/core/predictor_stream.js";
|
|||
import { Stream } from "../../src/core/stream.js";
|
||||
|
||||
describe("stream", function () {
|
||||
beforeEach(function () {
|
||||
jasmine.addMatchers({
|
||||
toMatchTypedArray(util, customEqualityTesters) {
|
||||
return {
|
||||
compare(actual, expected) {
|
||||
const result = {};
|
||||
if (actual.length !== expected.length) {
|
||||
result.pass = false;
|
||||
result.message =
|
||||
"Array length: " +
|
||||
actual.length +
|
||||
", expected: " +
|
||||
expected.length;
|
||||
return result;
|
||||
}
|
||||
result.pass = true;
|
||||
for (let i = 0, ii = expected.length; i < ii; i++) {
|
||||
const a = actual[i],
|
||||
b = expected[i];
|
||||
if (a !== b) {
|
||||
result.pass = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
});
|
||||
describe("PredictorStream", function () {
|
||||
it("should decode simple predictor data", function () {
|
||||
const dict = new Dict();
|
||||
|
@ -65,9 +35,7 @@ describe("stream", function () {
|
|||
const predictor = new PredictorStream(input, /* length = */ 9, dict);
|
||||
const result = predictor.getBytes(6);
|
||||
|
||||
expect(result).toMatchTypedArray(
|
||||
new Uint8Array([100, 3, 101, 2, 102, 1])
|
||||
);
|
||||
expect(result).toEqual(new Uint8Array([100, 3, 101, 2, 102, 1]));
|
||||
|
||||
predictor.reset();
|
||||
const clampedResult = predictor.getBytes(6, /* forceClamped = */ true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue