Skip to content

Commit

Permalink
Change domains on tests for ads/analytics (#26674)
Browse files Browse the repository at this point in the history
  • Loading branch information
powerivq committed Feb 8, 2020
1 parent 20039cd commit e6312c7
Show file tree
Hide file tree
Showing 12 changed files with 210 additions and 206 deletions.
4 changes: 2 additions & 2 deletions ads/google/a4a/shared/test/test-url-builder.js
Expand Up @@ -19,7 +19,7 @@ import {buildUrl} from '../url-builder';
describe('buildUrl', () => {
it('should build a simple URL', () => {
expect(
buildUrl('https://example.com', {'key': 'value'}, Infinity)
).to.equal('https://example.com?key=value');
buildUrl('https://example.test', {'key': 'value'}, Infinity)
).to.equal('https://example.test?key=value');
});
});
4 changes: 2 additions & 2 deletions extensions/amp-a4a/0.1/real-time-config-manager.js
Expand Up @@ -148,8 +148,8 @@ export class RealTimeConfigManager {
* Converts a URL into its corresponding shortened callout string.
* We also truncate to a maximum length of 50 characters.
* For instance, if we are passed
* "https://example.com/example.php?foo=a&bar=b, then we return
* example.com/example.php
* "https://example.test/example.php?foo=a&bar=b, then we return
* example.test/example.php
* @param {string} url
* @return {string}
*/
Expand Down
10 changes: 5 additions & 5 deletions extensions/amp-a4a/0.1/test/test-real-time-config-manager.js
Expand Up @@ -108,18 +108,18 @@ describes.realWin('real-time-config-manager', {amp: true}, env => {

describe('#getCalloutParam_', () => {
it('should convert url to callout param when parseable', () => {
const url = 'https://www.example.com/endpoint.php?unincluded';
const url = 'https://www.example.test/endpoint.php?unincluded';
const ard = getCalloutParam_(url);
expect(ard).to.equal('www.example.com/endpoint.php');
expect(ard).to.equal('www.example.test/endpoint.php');
});

it('should convert & trunc url when parseable', () => {
const url =
'https://www.example.com/thisIsTooMany' +
'https://www.example.test/thisIsTooMany' +
'Characters1234567891011121314.php';
const ard = getCalloutParam_(url);
expect(ard).to.equal(
'www.example.com/thisIsTooManyCharacters12345678910'
'www.example.test/thisIsTooManyCharacters1234567891'
);
});
});
Expand Down Expand Up @@ -976,7 +976,7 @@ describes.realWin('real-time-config-manager', {amp: true}, env => {
imageStub = env.sandbox.stub(env.win, 'Image').returns(imageMock);

errorType = RTC_ERROR_ENUM.TIMEOUT;
errorReportingUrl = 'https://www.example.com?e=ERROR_TYPE&h=HREF';
errorReportingUrl = 'https://www.example.test?e=ERROR_TYPE&h=HREF';
const whitelist = {ERROR_TYPE: true, HREF: true};
const macros = {
ERROR_TYPE: errorType,
Expand Down
20 changes: 11 additions & 9 deletions extensions/amp-ad/0.1/test/test-amp-ad-3p-impl.js
Expand Up @@ -33,7 +33,7 @@ function createAmpAd(win, attachToAmpdoc = false, ampdoc) {
type: '_ping_',
width: 300,
height: 250,
src: 'https://testsrc',
src: 'https://src.test',
'data-valid': 'true',
'data-width': '6666',
});
Expand All @@ -54,7 +54,7 @@ describes.realWin(
{
amp: {
runtimeOn: false,
canonicalUrl: 'https://canonical.url',
canonicalUrl: 'https://canonical.test',
},
allowExternalResources: true,
},
Expand Down Expand Up @@ -101,10 +101,12 @@ describes.realWin(
expect(url).to.match(/frame(.max)?.html/);
const data = JSON.parse(iframe.name).attributes;
expect(data).to.have.property('type', '_ping_');
expect(data).to.have.property('src', 'https://testsrc');
expect(data).to.have.property('src', 'https://src.test');
expect(data).to.have.property('width', 300);
expect(data).to.have.property('height', 250);
expect(data._context.canonicalUrl).to.equal('https://canonical.url/');
expect(data._context.canonicalUrl).to.equal(
'https://canonical.test/'
);
});
});

Expand Down Expand Up @@ -227,7 +229,7 @@ describes.realWin(
});

it('should use custom path', () => {
const remoteUrl = 'https://testsrc/boot/remote.html';
const remoteUrl = 'https://src.test/boot/remote.html';
const meta = win.document.createElement('meta');
meta.setAttribute('name', 'amp-3p-iframe-src');
meta.setAttribute('content', remoteUrl);
Expand All @@ -245,7 +247,7 @@ describes.realWin(
it('should use default path if custom disabled', () => {
const meta = win.document.createElement('meta');
meta.setAttribute('name', 'amp-3p-iframe-src');
meta.setAttribute('content', 'https://testsrc/boot/remote.html');
meta.setAttribute('content', 'https://src.test/boot/remote.html');
win.document.head.appendChild(meta);
ad3p.config.remoteHTMLDisabled = true;
ad3p.onLayoutMeasure();
Expand Down Expand Up @@ -340,13 +342,13 @@ describes.realWin(
);
expect(preconnects[preconnects.length - 1]).to.have.property(
'href',
'https://testsrc/'
'https://src.test/'
);
});
});

it('should use remote html path for preload', () => {
const remoteUrl = 'https://testsrc/boot/remote.html';
const remoteUrl = 'https://src.test/boot/remote.html';
const meta = win.document.createElement('meta');
meta.setAttribute('name', 'amp-3p-iframe-src');
meta.setAttribute('content', remoteUrl);
Expand All @@ -365,7 +367,7 @@ describes.realWin(
it('should not use remote html path for preload if disabled', () => {
const meta = win.document.createElement('meta');
meta.setAttribute('name', 'amp-3p-iframe-src');
meta.setAttribute('content', 'https://testsrc/boot/remote.html');
meta.setAttribute('content', 'https://src.test/boot/remote.html');
win.document.head.appendChild(meta);
ad3p.config.remoteHTMLDisabled = true;
ad3p.buildCallback();
Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-ad/0.1/test/test-amp-ad-custom.js
Expand Up @@ -85,14 +85,14 @@ describes.realWin('Amp custom ad', {amp: true}, env => {
}));

// Single ad with no slot
const url1 = 'example.com/ad';
const url1 = 'example.test/ad';
const element1 = getCustomAd(doc, url1);
const ad1 = new AmpAdCustom(element1);
ad1.buildCallback();
ad1.layoutCallback();

// Single ad with no slot
const url2 = 'example.com/ad';
const url2 = 'example.test/ad';
const element2 = getCustomAd(doc, url2);
const ad2 = new AmpAdCustom(element2);
ad2.buildCallback();
Expand Down
6 changes: 3 additions & 3 deletions extensions/amp-ad/0.1/test/test-amp-ad.js
Expand Up @@ -143,7 +143,7 @@ describes.realWin('Ad loader', {amp: true}, env => {
it('falls back to Delayed Fetch if remote.html is used', () => {
const meta = doc.createElement('meta');
meta.setAttribute('name', 'amp-3p-iframe-src');
meta.setAttribute('content', 'https://example.com/remote.html');
meta.setAttribute('content', 'https://example.test/remote.html');
doc.head.appendChild(meta);
a4aRegistry['zort'] = (win, element, useRemoteHtml) => {
return !useRemoteHtml;
Expand Down Expand Up @@ -182,7 +182,7 @@ describes.realWin('Ad loader', {amp: true}, env => {
it('uses Fast Fetch if remote.html and RTC are used', () => {
const meta = doc.createElement('meta');
meta.setAttribute('name', 'amp-3p-iframe-src');
meta.setAttribute('content', 'https://example.com/remote.html');
meta.setAttribute('content', 'https://example.test/remote.html');
doc.head.appendChild(meta);
a4aRegistry['zort'] = function() {
return true;
Expand Down Expand Up @@ -211,7 +211,7 @@ describes.realWin('Ad loader', {amp: true}, env => {
it('uses Fast Fetch if remote.html is used but disabled', () => {
const meta = doc.createElement('meta');
meta.setAttribute('name', 'amp-3p-iframe-src');
meta.setAttribute('content', 'https://example.com/remote.html');
meta.setAttribute('content', 'https://example.test/remote.html');
doc.head.appendChild(meta);
adConfig['zort'] = {remoteHTMLDisabled: true};
a4aRegistry['zort'] = function() {
Expand Down

0 comments on commit e6312c7

Please sign in to comment.