Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Latest commit

 

History

History

jest-google-maps-mock

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

jest-google-maps-mock

Build Status

Jest google maps mock

Installation

npm install --save-dev @wapps/jest-google-maps-mock

How to use

import createGoogleMapsMock from '@wapps/jest-google-maps-mock';

describe('createGoogleMapsMock', () => {
  let googleMaps;

  beforeEach(() => {
    googleMaps = createGoogleMapsMock();
  });

  it('should create a map mock', () => {
    const mapDiv = document.createElement('div');
    new googleMaps.Map(mapDiv);

    expect(googleMaps.Map).toHaveBeenCalledTimes(1);
    expect(googleMaps.Map.mock.instances.length).toBe(1);
    expect(googleMaps.Map).toHaveBeenLastCalledWith(mapDiv);
  });
});

License

MIT