Skip to content

Commit

Permalink
tests(vest): Async isolate done callback
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Nov 27, 2023
1 parent 4072be0 commit 5cfc7e8
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions packages/vest/src/suiteResult/done/__tests__/done.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,4 +373,42 @@ describe('done', () => {
expect(cb).not.toHaveBeenCalled();
});
});

describe('Async Isolate', () => {
describe('When async isolate is pending', () => {
it('Should not call the callback', () => {
const cb = jest.fn();

const suite = vest.create(() => {
vest.test('test', () => false);

vest.group('group', async () => {
await wait(1000);
});
});

suite().done(cb);

expect(cb).not.toHaveBeenCalled();
});
});

describe('When async isolate is completed', () => {
it('Should call the callback', async () => {
const cb = jest.fn();

const suite = vest.create(() => {
vest.test('test', () => false);

vest.group('group', async () => {
await wait(1000);
});
});

suite().done(cb);
await wait(1000);
expect(cb).toHaveBeenCalled();
});
});
});
});

2 comments on commit 5cfc7e8

@vercel
Copy link

@vercel vercel bot commented on 5cfc7e8 Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vest – ./website

vest-ealush.vercel.app
vest-git-latest-ealush.vercel.app
vest.vercel.app
vestjs.dev
www.vestjs.dev

@vercel
Copy link

@vercel vercel bot commented on 5cfc7e8 Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vest-next – ./website

vest-next-ealush.vercel.app
vest-next.vercel.app
vest-website.vercel.app
vest-next-git-latest-ealush.vercel.app

Please sign in to comment.