Skip to content

Commit 75a41a9

Browse files
committed
add unit test
1 parent 09afa4c commit 75a41a9

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

cypress/integration/spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// https://on.cypress.io/intelligent-code-completion
33
/// <reference types="Cypress" />
44

5+
import {add} from '../unit'
6+
57
context('Page test', () => {
68
beforeEach(() => {
79
cy.visit('/', {
@@ -17,3 +19,13 @@ context('Page test', () => {
1719
.should('have.been.calledWith', 'just names', ['joe', 'mary'])
1820
})
1921
})
22+
23+
context('Unit tests', () => {
24+
it('adds numbers', () => {
25+
expect(add(2, 3)).to.equal(5)
26+
})
27+
28+
it('concatenates strings', () => {
29+
expect(add('foo', 'Bar')).to.equal('fooBar')
30+
})
31+
})

cypress/unit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const add = (a, b) => a + b

0 commit comments

Comments
 (0)