Skip to content

Commit

Permalink
test: random fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowgate15 committed Aug 20, 2021
1 parent fbb94de commit a6d7785
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 11 deletions.
1 change: 0 additions & 1 deletion app/controllers/api/v1/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ async function add(ctx) {

if (body.copy) {
if (!_.isArray(body.jobs)) body.jobs = [body.jobs];
console.log(body);

const newJobs = [];

Expand Down
2 changes: 1 addition & 1 deletion test/api/v1/jobs/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test.before(async (t) => {
test('successfully', async (t) => {
const { api, bree } = t.context;

await delay(200);
await delay(300);

const res = await api.get(rootUrl);

Expand Down
5 changes: 2 additions & 3 deletions test/api/v1/stop.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ test.before(async (t) => {
t.context.api = t.context.api.auth(t.context.token, { type: 'bearer' });

t.context.bree.start();

await delay(200);
});

test.serial('successfully stop named job', async (t) => {
Expand All @@ -45,15 +47,12 @@ test.serial('successfully stop named job', async (t) => {

t.is(res.status, 200);

await delay(200);

t.falsy(bree.workers.active);
});

test.serial('successfully stop all jobs', async (t) => {
const { bree, api } = t.context;

t.not(Object.values(bree.workers).length, 0);
t.not(Object.values(bree.timeouts).length, 0);
t.not(Object.values(bree.intervals).length, 0);

Expand Down
7 changes: 1 addition & 6 deletions test/config/utilities.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
const test = require('ava');

const { json, emoji } = require('../../config/utilities');
const { json } = require('../../config/utilities');

test('returns JSON with 2 spaces', (t) => {
t.snapshot(json({ ok: 'hey' }));
});

test('returns valid emoji or empty string', (t) => {
t.is(emoji('cat'), '🐱');
t.is(emoji('invalid_emoji'), '');
});
1 change: 1 addition & 0 deletions test/jobs/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { parentPort } = require('worker_threads');

setTimeout(() => {
console.log('hello');
process.exit(0);
}, 100);

if (parentPort) {
Expand Down
1 change: 1 addition & 0 deletions test/jobs/long.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { parentPort } = require('worker_threads');

setTimeout(() => {
console.log('hello');
process.exit(0);
}, 10000);

if (parentPort) {
Expand Down

0 comments on commit a6d7785

Please sign in to comment.