Skip to content

CraigMcAulay1101/google-maps-places-mock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

google-maps-places-mock

Mock Google Maps Places service

Build Status version

Installation

npm install --save-dev google-maps-places-mock

Usage

The module is used to mock a Google Maps Places response, instead of making an API call to Googles Places Service. Returns dummy places Objects for use in unit testing.

The object is invoked in a very similar manner to how the places service is normally called.

Parameters

Position: {lat: 55.86279, lng: -4.25424} Radius (meters) 1000 Results (optional, defaults to 20)

Example

import GooglePlacesMock from 'google-maps-places-mock'

let g = new GooglePlacesMock({lat: 55.86279, lng: -4.25424}, 1000)

// Unit Test
it('Places should be an array', () => {
    g.nearbySearch().then((places) => {
        expect(places).to.be.an('array')    
    })
})

The result will return an array of objects, mocking the regular Google Maps Places Service API response

License

MIT

About

Google Maps Places Service mock

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published