Skip to content

Commit 6919517

Browse files
authored
test: prevent ci builds from failing due to time constraints (#520)
1 parent 090f871 commit 6919517

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/packages/serializer/test/serializer.test.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import Serializer from '../index';
88
import { VERSION as JSONAPI_VERSION } from '../../jsonapi';
99

1010
import range from '../../../utils/range';
11-
import setType from '../../../utils/set-type';
1211
import { getTestApp } from '../../../../test/utils/get-test-app';
1312

1413
import type Application from '../../application';
@@ -47,12 +46,18 @@ describe('module "serializer"', () => {
4746

4847
before(async () => {
4948
const { models } = await getTestApp();
50-
const Tag = setType(() => models.get('tag'));
51-
const Post = setType(() => models.get('post'));
52-
const User = setType(() => models.get('user'));
53-
const Image = setType(() => models.get('image'));
54-
const Comment = setType(() => models.get('comment'));
55-
const Categorization = setType(() => models.get('categorization'));
49+
// $FlowIgnore
50+
const Tag = models.get('tag');
51+
// $FlowIgnore
52+
const Post = models.get('post');
53+
// $FlowIgnore
54+
const User = models.get('user');
55+
// $FlowIgnore
56+
const Image = models.get('image');
57+
// $FlowIgnore
58+
const Comment = models.get('comment');
59+
// $FlowIgnore
60+
const Categorization = models.get('categorization');
5661

5762
class TestSerializer extends Serializer {
5863
attributes = [
@@ -336,7 +341,10 @@ describe('module "serializer"', () => {
336341
});
337342
});
338343

339-
it('works with an array of `Model` instances', async () => {
344+
it('works with an array of `Model` instances', async function () {
345+
this.slow(13 * 1000);
346+
this.timeout(25 * 1000);
347+
340348
const posts = await Promise.all(
341349
Array.from(range(1, 25)).map(() => {
342350
return createPost();

src/utils/test/sleep.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ describe('util sleep()', function () {
2020

2121
it('sleeps for the correct amount of time', async () => {
2222
await sleep(amount);
23-
expect(Date.now() - time).to.be.at.least(amount);
23+
expect(Date.now() - time).to.be.within(amount - 25, amount + 25);
2424
});
2525
});

0 commit comments

Comments
 (0)