-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathnull.cy.js
40 lines (36 loc) · 1015 Bytes
/
null.cy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/// <reference types="cypress" />
// @ts-check
import '../../src'
// https://github.com/bahmutov/cypress-if/issues/38
describe('null value', () => {
it('handles null assertion', () => {
cy.wrap(null)
.if('null')
.log('null value')
.then(cy.spy().as('if'))
.else()
.then(cy.spy().as('else'))
cy.get('@if').should('have.been.called')
cy.get('@else').should('not.have.been.called')
})
it('handles not.null assertion', () => {
cy.wrap(null)
.if('not.null')
.log('null value')
.then(cy.spy().as('if'))
.else()
.then(cy.spy().as('else'))
cy.get('@else').should('have.been.called')
cy.get('@if').should('not.have.been.called')
})
it('handles 42 with not.null assertion', () => {
cy.wrap(42)
.if('not.null')
.log('null value')
.then(cy.spy().as('if'))
.else()
.then(cy.spy().as('else'))
cy.get('@if').should('have.been.called')
cy.get('@else').should('not.have.been.called')
})
})