Skip to content

Commit

Permalink
feat: add context.each support (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Feb 1, 2022
1 parent ce71213 commit 3903d7b
Show file tree
Hide file tree
Showing 3 changed files with 7,500 additions and 31 deletions.
26 changes: 26 additions & 0 deletions cypress/integration/context-each-spec.js
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')
})
})
Loading

0 comments on commit 3903d7b

Please sign in to comment.