From fd027a65822e7ea62843db7e7de4e23a6c8901f5 Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Sun, 14 Feb 2021 15:02:42 +0100 Subject: [PATCH] Add test for workers --- package-lock.json | 6 +++--- package.json | 6 +++--- tests/worker/cluster-worker.test.js | 10 ++++++++++ tests/worker/thread-worker.test.js | 9 +++++++++ 4 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 tests/worker/cluster-worker.test.js create mode 100644 tests/worker/thread-worker.test.js diff --git a/package-lock.json b/package-lock.json index efed1e62..fe7d419b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4538,9 +4538,9 @@ "dev": true }, "uglify-js": { - "version": "3.12.7", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.12.7.tgz", - "integrity": "sha512-SIZhkoh+U/wjW+BHGhVwE9nt8tWJspncloBcFapkpGRwNPqcH8pzX36BXe3TPBjzHWPMUZotpCigak/udWNr1Q==", + "version": "3.12.8", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.12.8.tgz", + "integrity": "sha512-fvBeuXOsvqjecUtF/l1dwsrrf5y2BCUk9AOJGzGcm6tE7vegku5u/YvqjyDaAGr422PLoLnrxg3EnRvTqsdC1w==", "dev": true, "optional": true }, diff --git a/package.json b/package.json index ff1376df..fdba3a8b 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,9 @@ "benchmark": "npm run build && node benchmarks/bench.js", "benchmark:debug": "npm run build:dev && node -r source-map-support/register --inspect-brk benchmarks/bench.js", "benchmark:debug:vscode": "node -r source-map-support/register benchmarks/bench.js", - "test": "npm run build && nyc mocha --exit --timeout 20000 tests/**/*.test.js", - "test:debug": "npm run build:dev && mocha -r source-map-support/register --inspect-brk --exit tests/**/*.test.js", - "test:debug:vscode": "mocha -r source-map-support/register --exit tests/**/*.test.js", + "test": "npm run build && nyc mocha --exit --timeout 20000 'tests/**/*.test.js'", + "test:debug": "npm run build:dev && mocha -r source-map-support/register --inspect-brk --exit 'tests/**/*.test.js'", + "test:debug:vscode": "mocha -r source-map-support/register --exit 'tests/**/*.test.js'", "sonar": "sonar-scanner", "coverage": "nyc report --reporter=lcov --check-coverage --lines 80", "coverage:html": "nyc report --reporter=html --check-coverage --lines 80", diff --git a/tests/worker/cluster-worker.test.js b/tests/worker/cluster-worker.test.js new file mode 100644 index 00000000..fc2d3442 --- /dev/null +++ b/tests/worker/cluster-worker.test.js @@ -0,0 +1,10 @@ +const expect = require('expect') +const { ClusterWorker } = require('../../lib') + +describe('Cluster worker test suite', () => { + // Skipped because ClusterWorker would be in main instead of non-main worker + it.skip('Verify worker has default maxInactiveTime', () => { + const worker = new ClusterWorker(() => {}) + expect(worker.maxInactiveTime).toEqual(60_000) + }) +}) diff --git a/tests/worker/thread-worker.test.js b/tests/worker/thread-worker.test.js new file mode 100644 index 00000000..240534a7 --- /dev/null +++ b/tests/worker/thread-worker.test.js @@ -0,0 +1,9 @@ +const expect = require('expect') +const { ThreadWorker } = require('../../lib') + +describe('Thread worker test suite', () => { + it('Verify worker has default maxInactiveTime', () => { + const worker = new ThreadWorker(() => {}) + expect(worker.maxInactiveTime).toEqual(60_000) + }) +}) -- 2.34.1