-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix to have children matcher * fix typos
- Loading branch information
Showing
4 changed files
with
86 additions
and
13 deletions.
There are no files selected for viewing
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
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
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,59 @@ | ||
import { toHaveChildren } from '../../../src/matchers/element/toHaveChildren' | ||
|
||
describe('toHaveChildren', () => { | ||
test('no value', async () => { | ||
const el = await $('sel') | ||
|
||
const result = await toHaveChildren(el, { wait: 0 }) | ||
expect(result.pass).toBe(true) | ||
}) | ||
|
||
test('exact number value', async () => { | ||
const el = await $('sel') | ||
|
||
const result = await toHaveChildren(el, 2, { wait: 1 }) | ||
expect(result.pass).toBe(true) | ||
}) | ||
|
||
test('exact value', async () => { | ||
const el = await $('sel') | ||
|
||
const result = await toHaveChildren(el, { eq: 2, wait: 1 }) | ||
expect(result.pass).toBe(true) | ||
}) | ||
|
||
test('gte value', async () => { | ||
const el = await $('sel') | ||
|
||
const result = await toHaveChildren(el, { gte: 2, wait: 1 }) | ||
expect(result.pass).toBe(true) | ||
}) | ||
|
||
test('exact value - failure', async () => { | ||
const el = await $('sel') | ||
|
||
const result = await toHaveChildren(el, { eq: 3, wait: 1 }) | ||
expect(result.pass).toBe(false) | ||
}) | ||
|
||
test('lte value - failure', async () => { | ||
const el = await $('sel') | ||
|
||
const result = await toHaveChildren(el, { lte: 1, wait: 0 }) | ||
expect(result.pass).toBe(false) | ||
}) | ||
|
||
test('.not exact value - failure', async () => { | ||
const el = await $('sel') | ||
|
||
const result = await toHaveChildren.bind({ isNot: true })(el, { eq: 2, wait: 0 }) | ||
expect(result.pass).toBe(true) | ||
}) | ||
|
||
test('.not exact value - success', async () => { | ||
const el = await $('sel') | ||
|
||
const result = await toHaveChildren.bind({ isNot: true })(el, { eq: 3, wait: 1 }) | ||
expect(result.pass).toBe(false) | ||
}) | ||
}) |
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