Move the XRefMock in the unit tests to a central location

This patch helps to avoid code duplication for this mock since more unit
tests are depending on it.
This commit is contained in:
Tim van der Meij 2017-07-29 00:35:10 +02:00
parent 783d42ec2b
commit ab820438ae
No known key found for this signature in database
GPG key ID: 8C3FD2925A5F2762
5 changed files with 39 additions and 80 deletions

View file

@ -18,16 +18,9 @@ import { OperatorList, PartialEvaluator } from '../../src/core/evaluator';
import { Stream, StringStream } from '../../src/core/stream';
import { OPS } from '../../src/shared/util';
import { WorkerTask } from '../../src/core/worker';
import { XRefMock } from './test_utils';
describe('evaluator', function() {
function XrefMock(queue) {
this.queue = queue || [];
}
XrefMock.prototype = {
fetchIfRef() {
return this.queue.shift();
},
};
function HandlerMock() {
this.inputs = [];
}
@ -63,7 +56,7 @@ describe('evaluator', function() {
beforeAll(function(done) {
partialEvaluator = new PartialEvaluator({
pdfManager: new PdfManagerMock(),
xref: new XrefMock(),
xref: new XRefMock(),
handler: new HandlerMock(),
pageIndex: 0,
});