Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hupe1980/jest-google-maps-mock
Jest mock for google maps
https://github.com/hupe1980/jest-google-maps-mock
google google-maps google-maps-api jest mock
Last synced: about 1 month ago
JSON representation
Jest mock for google maps
- Host: GitHub
- URL: https://github.com/hupe1980/jest-google-maps-mock
- Owner: hupe1980
- License: mit
- Created: 2019-05-31T17:07:02.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T01:52:39.000Z (about 2 years ago)
- Last Synced: 2024-11-23T23:42:16.846Z (about 2 months ago)
- Topics: google, google-maps, google-maps-api, jest, mock
- Language: JavaScript
- Homepage:
- Size: 1.08 MB
- Stars: 8
- Watchers: 5
- Forks: 10
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jest-google-maps-mock
> Jest mock for google maps
## Installation
```sh
// with npm
npm install -D jest-google-maps-mock// with yarn
yarn add -D jest-google-maps-mock
```## How to use
```js
import createGoogleMapsMock from '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](LICENSE)