Update types to allow for alias 'key' for 'keys' with chai chainers (#7687)

This commit is contained in:
Jennifer Shehane
2020-06-15 19:55:14 +06:30
committed by GitHub
parent 8683510ba5
commit f883590eff
2 changed files with 20 additions and 0 deletions
+16
View File
@@ -3073,6 +3073,22 @@ declare namespace Cypress {
* @see https://on.cypress.io/assertions
*/
(chainer: 'equal', value: any): Chainable<Subject>
/**
* Causes all `.key` assertions that follow in the chain to require that the target have all of the given keys. This is the opposite of `.any`, which only requires that the target have at least one of the given keys.
* @example
* cy.wrap({ a: 1, b: 2 }).should('have.all.key', 'a', 'b')
* @see http://chaijs.com/api/bdd/#method_all
* @see https://on.cypress.io/assertions
*/
(chainer: 'have.all.key', ...value: string[]): Chainable<Subject>
/**
* Causes all `.key` assertions that follow in the chain to only require that the target have at least one of the given keys. This is the opposite of `.all`, which requires that the target have all of the given keys.
* @example
* cy.wrap({ a: 1, b: 2 }).should('have.any.key', 'a')
* @see http://chaijs.com/api/bdd/#method_any
* @see https://on.cypress.io/assertions
*/
(chainer: 'have.any.key', ...value: string[]): Chainable<Subject>
/**
* Causes all `.keys` assertions that follow in the chain to require that the target have all of the given keys. This is the opposite of `.any`, which only requires that the target have at least one of the given keys.
* @example
+4
View File
@@ -88,6 +88,10 @@ cy.wrap({ a: 1, b: 2 }).should('have.all.keys', 'a', 'b')
cy.wrap({ a: 1, b: 2 }).should('have.any.keys', 'a')
cy.wrap({ a: 1, b: 2 }).should('have.all.key', 'a', 'b')
cy.wrap({ a: 1, b: 2 }).should('have.any.key', 'a')
cy.wrap({ x: {a: 1 }}).should('have.deep.property', 'x', { a: 1 })
cy.wrap([1, 2, 3]).should('have.length', 3)