![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
googlemaps-js-api-stub
Advanced tools
Google Maps Javascript API is exposed under the window.google
namespace, and has an object structure that's fairly involved.
This makes testing of components and other UI logic that depend on the Maps API a bit inconvenient, since you would inevitably have to stub out quite a few of the Maps API objects and method calls in your tests, even for fairly trivial usages.
It usually ends up adding noise to your tests, and obscuring their intent.
This package stubs out the window.google
namespace, and all documented objects and methods of the Maps API under this namespace.
All of the stubs are noop
s and usually return an empty object, or an object with a sensible structure as appropriate.
Importing this package into your tests will let you focus on testing your component and UI logic without having to worry about details of the Maps API.
In addition, you can set up explicit expectations on specific Google Maps API calls when you are testing interactions with the Maps API.
Initial versions of this package stub out significant portions of the documented Maps API.
Eventually this package will be versioned in lockstep with the Maps API versions (i.e. importing version X
of this package will stub out version X
of the Maps API).
Install the package
npm install --save-dev googlemaps-js-api-stub
OR
yarn add --dev googlemaps-js-api-stub
Import googlemaps-js-api-stub
into your test
import 'googlemaps-js-api-stub'
OR
require 'googlemaps-js-api-stub'
Optionally, set expectations on specific API calls as required
sinon.stub(window.google.Map, 'setZoom');
expect(window.google.Map.setZoom).to.have.been.called
FAQs
Google Maps Javascript API Stub
The npm package googlemaps-js-api-stub receives a total of 939 weekly downloads. As such, googlemaps-js-api-stub popularity was classified as not popular.
We found that googlemaps-js-api-stub demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.