Skip to content

Commit

Permalink
Fix async job tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zodern committed Nov 23, 2024
1 parent 572d715 commit 098998a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions tests/models/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ Tinytest.add(
}
);

Tinytest.addAsync(
Tinytest.add(
'Models - Jobs - track new jobs',
async function (test) {
function (test) {
model.trackNewJob('analyze');
model.trackNewJob('analyze');
model.trackNewJob('analyze');
Expand All @@ -70,9 +70,9 @@ Tinytest.addAsync(
}
);

Tinytest.addAsync(
Tinytest.add(
'Models - Jobs - track active jobs',
async function (test) {
function (test) {
model.activeJobCounts.clear();
model.trackActiveJobs('analyze', 1);
model.trackActiveJobs('analyze', 1);
Expand All @@ -90,7 +90,7 @@ Tinytest.addAsync(
}
);

Tinytest.addAsync(
Tinytest.add(
'Models - Jobs - Monti.recordNewJob',
async function (test) {
Kadira.recordNewJob('hello');
Expand All @@ -100,7 +100,7 @@ Tinytest.addAsync(
}
);

Tinytest.addAsync(
Tinytest.add(
'Models - Jobs - Monti.recordPendingJobs',
async function (test) {
Kadira.recordPendingJobs('hello', 5);
Expand All @@ -126,17 +126,18 @@ Tinytest.add(

Tinytest.addAsync(
'Models - Jobs - traceJob - return async value',
async function (test) {
async function (test, done) {
let result = await Kadira.traceJob({ name: 'hello' }, () => Promise.resolve(5));

test.equal(result, 5);
CleanTestData();
done();
}
);

Tinytest.addAsync(
Tinytest.add(
'Models - Jobs - traceJob - track sync processor',
async function (test) {
function (test) {
Kadira.traceJob({ name: 'hello' }, () => {
TestData.find().fetch();
});
Expand All @@ -151,7 +152,7 @@ Tinytest.addAsync(

Tinytest.addAsync(
'Models - Jobs - traceJob - track active status',
async function (test) {
async function (test, done) {
model.activeJobCounts.clear();

let resolver;
Expand All @@ -175,6 +176,7 @@ Tinytest.addAsync(
test.equal(payload.jobMetrics[0].jobs.hello.count, 1);

CleanTestData();
done();
}
);

Expand Down

0 comments on commit 098998a

Please sign in to comment.