Initial commit for Greenlens
This commit is contained in:
19
__tests__/components/Toast.test.tsx
Normal file
19
__tests__/components/Toast.test.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react-native';
|
||||
import { Toast } from '../../components/Toast';
|
||||
|
||||
describe('Toast', () => {
|
||||
it('renders message when visible', () => {
|
||||
const { getByText } = render(
|
||||
<Toast message="Plant saved!" isVisible={true} onClose={jest.fn()} />
|
||||
);
|
||||
expect(getByText('Plant saved!')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('does not render when not visible', () => {
|
||||
const { queryByText } = render(
|
||||
<Toast message="Plant saved!" isVisible={false} onClose={jest.fn()} />
|
||||
);
|
||||
expect(queryByText('Plant saved!')).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user