Skip to content

Commit

Permalink
♻️ update tests to use vitest and react-testing-library
Browse files Browse the repository at this point in the history
  • Loading branch information
mihailgaberov committed Dec 31, 2023
1 parent e28a53e commit 5a3cb12
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/components/Timestamp/Timestamp.test.tsx
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();
});
});

0 comments on commit 5a3cb12

Please sign in to comment.