Skip to content

Commit

Permalink
test: prevent ci builds from failing due to time constraints (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharygolba authored Nov 12, 2016
1 parent 090f871 commit 6919517
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
24 changes: 16 additions & 8 deletions src/packages/serializer/test/serializer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Serializer from '../index';
import { VERSION as JSONAPI_VERSION } from '../../jsonapi';

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

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

before(async () => {
const { models } = await getTestApp();
const Tag = setType(() => models.get('tag'));
const Post = setType(() => models.get('post'));
const User = setType(() => models.get('user'));
const Image = setType(() => models.get('image'));
const Comment = setType(() => models.get('comment'));
const Categorization = setType(() => models.get('categorization'));
// $FlowIgnore
const Tag = models.get('tag');
// $FlowIgnore
const Post = models.get('post');
// $FlowIgnore
const User = models.get('user');
// $FlowIgnore
const Image = models.get('image');
// $FlowIgnore
const Comment = models.get('comment');
// $FlowIgnore
const Categorization = models.get('categorization');

class TestSerializer extends Serializer {
attributes = [
Expand Down Expand Up @@ -336,7 +341,10 @@ describe('module "serializer"', () => {
});
});

it('works with an array of `Model` instances', async () => {
it('works with an array of `Model` instances', async function () {
this.slow(13 * 1000);
this.timeout(25 * 1000);

const posts = await Promise.all(
Array.from(range(1, 25)).map(() => {
return createPost();
Expand Down
2 changes: 1 addition & 1 deletion src/utils/test/sleep.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ describe('util sleep()', function () {

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

0 comments on commit 6919517

Please sign in to comment.