-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
packages/vest/src/suiteResult/selectors/__tests__/isTested.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import wait from 'wait'; | ||
|
||
import * as vest from 'vest'; | ||
|
||
describe('isTested', () => { | ||
describe('When no field name is passed', () => { | ||
describe('When suite has no tests', () => { | ||
it('Should return false', () => { | ||
const suite = vest.create(() => {}); | ||
suite(); | ||
// @ts-ignore - invalid input | ||
expect(suite.isTested()).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('When suite has tests', () => { | ||
it('Should return false', () => { | ||
const suite = vest.create(() => { | ||
vest.test('f1', () => {}); | ||
}); | ||
suite(); | ||
// @ts-ignore - invalid input | ||
expect(suite.isTested()).toBe(false); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('When suite has no tests', () => { | ||
it('Should return false', () => { | ||
const suite = vest.create(() => {}); | ||
suite(); | ||
expect(suite.isTested('f1')).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('When suite has tests', () => { | ||
describe('When field has no tests', () => { | ||
it('Should return false', () => { | ||
const suite = vest.create(() => { | ||
vest.test('f1', () => {}); | ||
}); | ||
suite(); | ||
expect(suite.isTested('f2')).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('When field has tests', () => { | ||
it('Should return true', () => { | ||
const suite = vest.create(() => { | ||
vest.test('f1', () => {}); | ||
}); | ||
suite(); | ||
expect(suite.isTested('f1')).toBe(true); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('When async test is pending', () => { | ||
it('Should return false', async () => { | ||
const suite = vest.create(() => { | ||
vest.test('f1', async () => { | ||
await wait(100); | ||
}); | ||
}); | ||
suite(); | ||
expect(suite.isTested('f1')).toBe(true); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31d7848
There was a problem hiding this comment.
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-git-latest-ealush.vercel.app
www.vestjs.dev
vest-ealush.vercel.app
vest.vercel.app
vestjs.dev
31d7848
There was a problem hiding this comment.
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-website.vercel.app
vest-next.vercel.app
vest-next-git-latest-ealush.vercel.app
vest-next-ealush.vercel.app