Advertisement
StrongJava

Untitled

Jun 12th, 2019
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. import React from 'react';
  2. import {cleanup, render, wait } from '@testing-library/react';
  3. import 'jest-dom/extend-expect';
  4. import Map from '../Map';
  5.  
  6. const myPosit = {
  7. lat: 29,
  8. lng: -98
  9. };
  10.  
  11. describe('Map', () => {
  12.  
  13. afterEach(() => {
  14. cleanup()
  15. });
  16.  
  17. it('renders into document', async () => {
  18.  
  19. // Arrange
  20. const props = {
  21. mapOptions: {
  22. myPosit: myPosit,
  23. zoom: 12
  24. },
  25. markerOptions: {
  26. center: myPosit,
  27. label: "Hello"
  28. }
  29. }
  30.  
  31. // Act
  32.  
  33. const { getByText } = render(<Map {...props} />)
  34. await wait(() => getByText(props.markerOptions.label, 'Hello'));
  35.  
  36. // Assert
  37. const markerLabel = getByText(props.markerOptions.label);
  38. expect (markerLabel).toBeDefined();
  39.  
  40. })
  41. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement