-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ update tests to use vitest and react-testing-library
- Loading branch information
1 parent
e28a53e
commit 5a3cb12
Showing
1 changed file
with
7 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import { shallow } from 'enzyme'; | ||
import * as React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
import Timestamp from './Timestamp'; | ||
|
||
const setup = (value = '') => { | ||
return shallow(<Timestamp value={value} floatToRight={true}/>) | ||
return render(<Timestamp value={value} floatToRight={true}/>) | ||
}; | ||
|
||
describe('Timestamp component', () => { | ||
describe('Timestamp', () => { | ||
it('renders without crashing', () => { | ||
const wrapper = setup(); | ||
expect(wrapper).not.toBe(null) | ||
}); | ||
|
||
it('should be able to render properly value passed as prop', () => { | ||
let wrapper = setup(); | ||
expect(wrapper.text()).toBe(''); | ||
wrapper = setup('11:22'); | ||
expect(wrapper.text()).toBe('11:22'); | ||
setup('11:22'); | ||
expect(screen.getByText('11:22')).toBeVisible(); | ||
}); | ||
}); |