From 5a3cb12e583fa91c61ffbb26e3a3bef49260732f Mon Sep 17 00:00:00 2001 From: mihailgaberov Date: Sun, 31 Dec 2023 13:16:32 +0100 Subject: [PATCH] :recycle: update tests to use vitest and react-testing-library --- src/components/Timestamp/Timestamp.test.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/Timestamp/Timestamp.test.tsx b/src/components/Timestamp/Timestamp.test.tsx index 4948a1c..790aea1 100644 --- a/src/components/Timestamp/Timestamp.test.tsx +++ b/src/components/Timestamp/Timestamp.test.tsx @@ -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() + return render() }; -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(); }); });