diff --git a/test/unit/preprocessor.spec.js b/test/unit/preprocessor.spec.js index 1f59eb87f..2b5fefbc2 100644 --- a/test/unit/preprocessor.spec.js +++ b/test/unit/preprocessor.spec.js @@ -11,7 +11,7 @@ describe('preprocessor', () => { let mockFs let emitterSetting // mimic first few bytes of a pdf file - const binarydata = new Buffer([0x25, 0x50, 0x44, 0x66, 0x46, 0x00]) // eslint-disable-line node/no-deprecated-api + const binarydata = Buffer.from([0x25, 0x50, 0x44, 0x66, 0x46, 0x00]) beforeEach(() => { mockFs = mocks.fs.create({ diff --git a/test/unit/runner.spec.js b/test/unit/runner.spec.js index 97cefc49a..82f0eb15b 100644 --- a/test/unit/runner.spec.js +++ b/test/unit/runner.spec.js @@ -14,12 +14,12 @@ describe('runner', () => { const EXIT = constant.EXIT_CODE it('should return 0 exit code if present in the buffer', () => { - const result = m.parseExitCode(new Buffer(`something\nfake${EXIT}10`)) // eslint-disable-line node/no-deprecated-api + const result = m.parseExitCode(Buffer.from(`something\nfake${EXIT}10`)) expect(result.exitCode).to.equal(0) }) it('should remove the exit code part of the returned buffer', () => { - const buffer = new Buffer(`some${EXIT}01`) // eslint-disable-line node/no-deprecated-api + const buffer = Buffer.from(`some${EXIT}01`) const result = m.parseExitCode(buffer) expect(buffer.toString()).to.equal(`some${EXIT}01`) @@ -28,7 +28,7 @@ describe('runner', () => { it('should not touch buffer without exit code and return default', () => { const msg = 'some nice \n messgae {}' - const buffer = new Buffer(msg) // eslint-disable-line node/no-deprecated-api + const buffer = Buffer.from(msg) const result = m.parseExitCode(buffer, 10) expect(result.buffer.toString()).to.equal(msg) @@ -53,21 +53,21 @@ describe('runner', () => { }) it('should parse any single digit exit code', () => { - expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}01`)).exitCode).to.equal(1) // eslint-disable-line node/no-deprecated-api - expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}17`)).exitCode).to.equal(7) // eslint-disable-line node/no-deprecated-api + expect(m.parseExitCode(Buffer.from(`something\nfake${EXIT}01`)).exitCode).to.equal(1) + expect(m.parseExitCode(Buffer.from(`something\nfake${EXIT}17`)).exitCode).to.equal(7) }) it('should return exit code 0 if failOnEmptyTestSuite is false and and non-empty int is 0', () => { - expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}01`), undefined, false).exitCode).to.equal(0) // eslint-disable-line node/no-deprecated-api + expect(m.parseExitCode(Buffer.from(`something\nfake${EXIT}01`), undefined, false).exitCode).to.equal(0) }) it('should return exit code if failOnEmptyTestSuite is true', () => { - expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}00`), undefined, true).exitCode).to.equal(0) // eslint-disable-line node/no-deprecated-api - expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}01`), undefined, true).exitCode).to.equal(1) // eslint-disable-line node/no-deprecated-api - expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}07`), undefined, true).exitCode).to.equal(7) // eslint-disable-line node/no-deprecated-api - expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}10`), undefined, true).exitCode).to.equal(0) // eslint-disable-line node/no-deprecated-api - expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}11`), undefined, true).exitCode).to.equal(1) // eslint-disable-line node/no-deprecated-api - expect(m.parseExitCode(new Buffer(`something\nfake${EXIT}17`), undefined, true).exitCode).to.equal(7) // eslint-disable-line node/no-deprecated-api + expect(m.parseExitCode(Buffer.from(`something\nfake${EXIT}00`), undefined, true).exitCode).to.equal(0) + expect(m.parseExitCode(Buffer.from(`something\nfake${EXIT}01`), undefined, true).exitCode).to.equal(1) + expect(m.parseExitCode(Buffer.from(`something\nfake${EXIT}07`), undefined, true).exitCode).to.equal(7) + expect(m.parseExitCode(Buffer.from(`something\nfake${EXIT}10`), undefined, true).exitCode).to.equal(0) + expect(m.parseExitCode(Buffer.from(`something\nfake${EXIT}11`), undefined, true).exitCode).to.equal(1) + expect(m.parseExitCode(Buffer.from(`something\nfake${EXIT}17`), undefined, true).exitCode).to.equal(7) }) }) })