mirror of
https://github.com/theoludwig/theoludwig.git
synced 2025-05-29 22:37:44 +02:00
chore: remove jest -> cypress for unit tests
This commit is contained in:
18
cypress/component/Footer.cy.tsx
Normal file
18
cypress/component/Footer.cy.tsx
Normal file
@ -0,0 +1,18 @@
|
||||
import { Footer } from 'components/Footer'
|
||||
|
||||
describe('<Footer />', () => {
|
||||
it('should render with appropriate link tag version', () => {
|
||||
const version = '1.0.0'
|
||||
cy.mount(<Footer version={version} />)
|
||||
cy.contains('Divlo')
|
||||
.get('[data-cy=version-link]')
|
||||
.should('have.text', version)
|
||||
.should(
|
||||
'have.attr',
|
||||
'href',
|
||||
`https://github.com/Divlo/Divlo/releases/tag/v${version}`
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
export {}
|
17
cypress/component/utils/getAge.cy.ts
Normal file
17
cypress/component/utils/getAge.cy.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { getAge } from '../../../utils/getAge'
|
||||
|
||||
describe('utils/getAge', () => {
|
||||
it('should calculate the right age of a person', () => {
|
||||
cy.clock(new Date('2018-03-20')).then(() => {
|
||||
const birthDate = new Date('1980-02-20')
|
||||
expect(getAge(birthDate)).equal(38)
|
||||
})
|
||||
})
|
||||
|
||||
it('should calculate the right age of a person (taking into account the months)', () => {
|
||||
cy.clock(new Date('2018-03-20')).then(() => {
|
||||
const birthDate = new Date('1980-07-20')
|
||||
expect(getAge(birthDate)).equal(37)
|
||||
})
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user