MCPcopy Index your code
hub / github.com/ampproject/amphtml / stubServiceForDoc

Function stubServiceForDoc

testing/helpers/service.js:25–34  ·  view source on GitHub ↗
(sandbox, ampdoc, serviceId, method)

Source from the content-addressed store, hash-verified

23}
24
25export function stubServiceForDoc(sandbox, ampdoc, serviceId, method) {
26 // Register if not already registered.
27 registerServiceBuilderForDoc(ampdoc, serviceId, function () {
28 return {
29 [method]: () => {},
30 };
31 });
32 const service = getServiceForDoc(ampdoc, serviceId);
33 return sandbox.stub(service, method);
34}
35
36export function mockServiceForDoc(sandbox, ampdoc, serviceId, methods) {
37 resetServiceForTesting(ampdoc.win, serviceId);

Callers 3

test-cid.jsFile · 0.90

Calls 2

getServiceForDocFunction · 0.90

Tested by

no test coverage detected