-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Custom filter predicate You can filter the items by passing a predicate function ```js it.each(items, (x, k) => ...) // creates a test for every item the predicate returns a truthy value ```
- Loading branch information
Showing
4 changed files
with
34 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// @ts-check | ||
/// <reference types="cypress" /> | ||
|
||
import '../../src' | ||
|
||
describe('filter function', () => { | ||
const items = [1, 2, 3, 4] | ||
|
||
it.each(items, (x, k) => x === 4)('only the last item matches %d', (x) => { | ||
expect(x).to.equal(4) | ||
}) | ||
|
||
it.each(items, (x, k) => k === 1)( | ||
'only allows the 2nd item by index %d', | ||
(x) => { | ||
expect(x).to.equal(2) | ||
}, | ||
) | ||
}) |
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