repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test: add queue tests
[poolifier.git]
/
tests
/
worker-files
/
thread
/
testWorker.js
diff --git
a/tests/worker-files/thread/testWorker.js
b/tests/worker-files/thread/testWorker.js
index 773e11164014a35a01e3cfc0dfe3f8f797d46336..668587dbf0bb85925640d9d90e90f991efde7cbf 100644
(file)
--- a/
tests/worker-files/thread/testWorker.js
+++ b/
tests/worker-files/thread/testWorker.js
@@
-1,11
+1,17
@@
'use strict'
'use strict'
-const { ThreadWorker, KillBehaviors } = require('../../../lib/index')
const { isMainThread } = require('worker_threads')
const { isMainThread } = require('worker_threads')
+const { ThreadWorker, KillBehaviors } = require('../../../lib')
const TestUtils = require('../../test-utils')
const TestUtils = require('../../test-utils')
+const { WorkerFunctions } = require('../../test-types')
function test (data) {
function test (data) {
- TestUtils.jsonIntegerSerialization(100)
- return isMainThread
+ data = data || {}
+ data.function = data.function || WorkerFunctions.jsonIntegerSerialization
+ const result = TestUtils.executeWorkerFunction(data)
+ if (result == null) {
+ return isMainThread
+ }
+ return result
}
module.exports = new ThreadWorker(test, {
}
module.exports = new ThreadWorker(test, {