Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react';
- import {cleanup, render, wait } from '@testing-library/react';
- import 'jest-dom/extend-expect';
- import Map from '../Map';
- const myPosit = {
- lat: 29,
- lng: -98
- };
- describe('Map', () => {
- afterEach(() => {
- cleanup()
- });
- it('renders into document', async () => {
- // Arrange
- const props = {
- mapOptions: {
- myPosit: myPosit,
- zoom: 12
- },
- markerOptions: {
- center: myPosit,
- label: "Hello"
- }
- }
- // Act
- const { getByText } = render(<Map {...props} />)
- await wait(() => getByText(props.markerOptions.label, 'Hello'));
- // Assert
- const markerLabel = getByText(props.markerOptions.label);
- expect (markerLabel).toBeDefined();
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement