Skip to content

Commit

Permalink
repaired non-working tests due to lasts patch
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanschwarz committed Jan 21, 2021
1 parent 422fbf3 commit 25b2405
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/tests/_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function onJobError(job) {
}

function messageBroker(respond, msg) {
console.log(`\n\n${msg}\n\n`)
console.log(`\n\n${msg.data}\n\n`)
if (msg.data === 'ping') {
respond('pong')
}
Expand Down
2 changes: 1 addition & 1 deletion src/tests/ipcTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function ipcSinglePingTest(job, toggleIPC) {
(msg, closeIPC) => {
console.log(`\n\n${msg}\n\n`)
closeIPC()
}, (smtm) => smtmt({ status: 4, data: 'ping' })
}, (smtm) => smtm({ status: 4, data: 'ping' })
)
}

Expand Down
6 changes: 3 additions & 3 deletions src/tests/simpleTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function simpleAsyncTest(job) {
function logDiff(msDiff, taskType, _id) {
if (msDiff < 0) {
throw new Error(`\n\n[${taskType}][${_id}]: called too soon: diff is ${msDiff}ms\n\n`)
} else if (msDiff > 1000) {
} else if (msDiff > 5000) {
throw new Error(`\n\n[${taskType}][${_id}]: called too late: diff is ${msDiff}ms\n\n`)
}
console.log(`\n\n[${taskType}][${_id}]: called on time: diff is ${msDiff}ms\n\n`)
Expand All @@ -38,10 +38,10 @@ function simpleSchedTest(job) {

function simpleRecuringTest(job) {
handleMsDiff(job)
if (job.data.completeted < 3) {
if (job.data.completed < 3 || job.data.completed === undefined) {
const dueDate = new Date()
dueDate.setSeconds(dueDate.getSeconds() + 5)
TaskQueue.addTask({ taskType: 'simpleRecuringTest', data: { ...job.data, completed: (job.data.completeted || 0) + 1, startsInMemory: job.data.completed === 2 }, dueDate })
TaskQueue.addTask({ taskType: 'simpleRecuringTest', data: { ...job.data, completed: (job.data.completed || 0) + 1, startsInMemory: job.data.completed === 2 }, dueDate })
}
}

Expand Down

0 comments on commit 25b2405

Please sign in to comment.