-
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.
feat: add context.each support (#33)
- Loading branch information
Showing
3 changed files
with
7,500 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// @ts-check | ||
/// <reference types="cypress" /> | ||
|
||
import '../../src' | ||
|
||
const n = context.each(['A', 1])('%s', (x) => { | ||
before(() => { | ||
expect(n, 'number of created suites').to.equal(2) | ||
}) | ||
// we can use the values passed into the "context" callback | ||
// because these are closure variables | ||
it(`checks out for ${x}`, () => { | ||
cy.wrap(x).should('equal', x) | ||
}) | ||
}) | ||
|
||
context.each([ | ||
{ name: 'Joe', age: 30 }, | ||
{ name: 'Mary', age: 20 }, | ||
])('has correct types', (user) => { | ||
it('checks out', () => { | ||
expect(user).to.have.keys('name', 'age') | ||
expect(user.name).to.be.a('string') | ||
expect(user.age).to.be.a('number') | ||
}) | ||
}) |
Oops, something went wrong.