MCPcopy
hub / github.com/ampproject/amphtml / testAmpComponents

Function testAmpComponents

test/integration/test-amphtml-ads.js:424–442  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

422});
423
424function testAmpComponents() {
425 const imgPromise = RequestBank.withdraw('image').then((req) => {
426 expect(req.url).to.equal('/');
427 });
428 const pixelPromise = RequestBank.withdraw('pixel').then((req) => {
429 expect(req.url).to.equal('/foo?cid=');
430 });
431 const analyticsPromise = RequestBank.withdraw('analytics').then((req) => {
432 expect(req.url).to.match(/^\/bar\?/);
433 const queries = parseQueryString(req.url.substr('/bar'.length));
434 expect(queries['cid']).to.equal('');
435 expect(queries['sourceUrl']).be.ok;
436 // Cookie is sent via http response header when requesting
437 // localhost:9876/amp4test/a4a/
438 // COOKIE macro is not allowed in inabox and resolves to empty
439 expect(queries['cookie']).to.equal('');
440 });
441 return Promise.all([imgPromise, pixelPromise, analyticsPromise]);
442}
443
444function testAmpComponentsBTF(win) {
445 // The iframe starts BTF. "visible" trigger should be after scroll.

Callers 1

Calls 4

parseQueryStringFunction · 0.90
expectFunction · 0.85
withdrawMethod · 0.80
thenMethod · 0.45

Tested by

no test coverage detected