[misc] bump the dev-env to 3.3.2

This commit is contained in:
Jakob Ackermann
2020-08-10 17:01:11 +01:00
parent 1ee48d0274
commit f4561c2fe2
66 changed files with 1371 additions and 1458 deletions

View File

@@ -21,8 +21,8 @@ const path = require('path')
const { expect } = require('chai')
const { EventEmitter } = require('events')
describe('OutputFileOptimiser', function() {
beforeEach(function() {
describe('OutputFileOptimiser', function () {
beforeEach(function () {
this.OutputFileOptimiser = SandboxedModule.require(modulePath, {
requires: {
fs: (this.fs = {}),
@@ -37,14 +37,14 @@ describe('OutputFileOptimiser', function() {
return (this.callback = sinon.stub())
})
describe('optimiseFile', function() {
beforeEach(function() {
describe('optimiseFile', function () {
beforeEach(function () {
this.src = './output.pdf'
return (this.dst = './output.pdf')
})
describe('when the file is not a pdf file', function() {
beforeEach(function(done) {
describe('when the file is not a pdf file', function () {
beforeEach(function (done) {
this.src = './output.log'
this.OutputFileOptimiser.checkIfPDFIsOptimised = sinon
.stub()
@@ -55,21 +55,21 @@ describe('OutputFileOptimiser', function() {
return this.OutputFileOptimiser.optimiseFile(this.src, this.dst, done)
})
it('should not check if the file is optimised', function() {
it('should not check if the file is optimised', function () {
return this.OutputFileOptimiser.checkIfPDFIsOptimised
.calledWith(this.src)
.should.equal(false)
})
return it('should not optimise the file', function() {
return it('should not optimise the file', function () {
return this.OutputFileOptimiser.optimisePDF
.calledWith(this.src, this.dst)
.should.equal(false)
})
})
describe('when the pdf file is not optimised', function() {
beforeEach(function(done) {
describe('when the pdf file is not optimised', function () {
beforeEach(function (done) {
this.OutputFileOptimiser.checkIfPDFIsOptimised = sinon
.stub()
.callsArgWith(1, null, false)
@@ -79,21 +79,21 @@ describe('OutputFileOptimiser', function() {
return this.OutputFileOptimiser.optimiseFile(this.src, this.dst, done)
})
it('should check if the pdf is optimised', function() {
it('should check if the pdf is optimised', function () {
return this.OutputFileOptimiser.checkIfPDFIsOptimised
.calledWith(this.src)
.should.equal(true)
})
return it('should optimise the pdf', function() {
return it('should optimise the pdf', function () {
return this.OutputFileOptimiser.optimisePDF
.calledWith(this.src, this.dst)
.should.equal(true)
})
})
return describe('when the pdf file is optimised', function() {
beforeEach(function(done) {
return describe('when the pdf file is optimised', function () {
beforeEach(function (done) {
this.OutputFileOptimiser.checkIfPDFIsOptimised = sinon
.stub()
.callsArgWith(1, null, true)
@@ -103,13 +103,13 @@ describe('OutputFileOptimiser', function() {
return this.OutputFileOptimiser.optimiseFile(this.src, this.dst, done)
})
it('should check if the pdf is optimised', function() {
it('should check if the pdf is optimised', function () {
return this.OutputFileOptimiser.checkIfPDFIsOptimised
.calledWith(this.src)
.should.equal(true)
})
return it('should not optimise the pdf', function() {
return it('should not optimise the pdf', function () {
return this.OutputFileOptimiser.optimisePDF
.calledWith(this.src, this.dst)
.should.equal(false)
@@ -117,8 +117,8 @@ describe('OutputFileOptimiser', function() {
})
})
return describe('checkIfPDFISOptimised', function() {
beforeEach(function() {
return describe('checkIfPDFISOptimised', function () {
beforeEach(function () {
this.callback = sinon.stub()
this.fd = 1234
this.fs.open = sinon.stub().yields(null, this.fd)
@@ -126,18 +126,15 @@ describe('OutputFileOptimiser', function() {
.stub()
.withArgs(this.fd)
.yields(null, 100, Buffer.from('hello /Linearized 1'))
this.fs.close = sinon
.stub()
.withArgs(this.fd)
.yields(null)
this.fs.close = sinon.stub().withArgs(this.fd).yields(null)
return this.OutputFileOptimiser.checkIfPDFIsOptimised(
this.src,
this.callback
)
})
describe('for a linearised file', function() {
beforeEach(function() {
describe('for a linearised file', function () {
beforeEach(function () {
this.fs.read = sinon
.stub()
.withArgs(this.fd)
@@ -148,25 +145,25 @@ describe('OutputFileOptimiser', function() {
)
})
it('should open the file', function() {
it('should open the file', function () {
return this.fs.open.calledWith(this.src, 'r').should.equal(true)
})
it('should read the header', function() {
it('should read the header', function () {
return this.fs.read.calledWith(this.fd).should.equal(true)
})
it('should close the file', function() {
it('should close the file', function () {
return this.fs.close.calledWith(this.fd).should.equal(true)
})
return it('should call the callback with a true result', function() {
return it('should call the callback with a true result', function () {
return this.callback.calledWith(null, true).should.equal(true)
})
})
return describe('for an unlinearised file', function() {
beforeEach(function() {
return describe('for an unlinearised file', function () {
beforeEach(function () {
this.fs.read = sinon
.stub()
.withArgs(this.fd)
@@ -177,19 +174,19 @@ describe('OutputFileOptimiser', function() {
)
})
it('should open the file', function() {
it('should open the file', function () {
return this.fs.open.calledWith(this.src, 'r').should.equal(true)
})
it('should read the header', function() {
it('should read the header', function () {
return this.fs.read.calledWith(this.fd).should.equal(true)
})
it('should close the file', function() {
it('should close the file', function () {
return this.fs.close.calledWith(this.fd).should.equal(true)
})
return it('should call the callback with a false result', function() {
return it('should call the callback with a false result', function () {
return this.callback.calledWith(null, false).should.equal(true)
})
})