Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quantcast adapter onTimeout #3239

Merged
merged 7 commits into from
Oct 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion modules/quantcastBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as utils from 'src/utils';
import { ajax } from 'src/ajax';
import { registerBidder } from 'src/adapters/bidderFactory';

const BIDDER_CODE = 'quantcast';
Expand Down Expand Up @@ -69,7 +70,7 @@ export const spec = {
});
});

const gdprConsent = bidderRequest ? bidderRequest.gdprConsent : {};
const gdprConsent = (bidderRequest && bidderRequest.gdprConsent) ? bidderRequest.gdprConsent : {};

// Request Data Format can be found at https://wiki.corp.qc/display/adinf/QCX
const requestData = {
Expand Down Expand Up @@ -157,6 +158,10 @@ export const spec = {
});

return bidResponsesList;
},
onTimeout(timeoutData) {
const url = `${QUANTCAST_PROTOCOL}://${QUANTCAST_DOMAIN}:${QUANTCAST_PORT}/qchb_notify?type=timeout`;
ajax(url, null, null);
}
};

Expand Down
17 changes: 17 additions & 0 deletions test/spec/modules/quantcastBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as utils from 'src/utils';
import { expect } from 'chai';
import { stub, sandbox } from 'sinon';
import {
QUANTCAST_DOMAIN,
QUANTCAST_TEST_DOMAIN,
Expand All @@ -12,6 +13,7 @@ import {
} from '../../../modules/quantcastBidAdapter';
import { newBidder } from '../../../src/adapters/bidderFactory';
import { parse } from 'src/url';
import * as ajax from 'src/ajax';

describe('Quantcast adapter', function () {
const quantcastAdapter = newBidder(qcSpec);
Expand Down Expand Up @@ -211,4 +213,19 @@ describe('Quantcast adapter', function () {
expect(interpretedResponse.length).to.equal(0);
});
});

describe('`onTimeout`', function() {
it('makes a request to the notify endpoint', function() {
const sinonSandbox = sandbox.create();
const ajaxStub = sinonSandbox.stub(ajax, 'ajax').callsFake(function() {});
const timeoutData = {
bidder: 'quantcast'
};
qcSpec.onTimeout(timeoutData);
const expectedUrl = `${QUANTCAST_PROTOCOL}://${QUANTCAST_DOMAIN}:${QUANTCAST_PORT}/qchb_notify?type=timeout`;
ajaxStub.withArgs(expectedUrl, null, null).calledOnce.should.be.true;
ajaxStub.restore();
sinonSandbox.restore();
});
});
});