Skip to content

Commit

Permalink
Adding test case for X2 Tokenize
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Palladino committed Jan 14, 2025
1 parent 7ab5ec8 commit f246e2e
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/spec/modules/symitriDapRtdProvider_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ describe('symitriDapRtdProvider', function() {
'identity': sampleIdentity
}

const sampleX2Config = {
'api_hostname': 'prebid.dap.akadns.net',
'api_version': 'x2',
'domain': 'prebid.org',
'segtax': 708,
'identity': sampleIdentity
}

const esampleConfig = {
'api_hostname': 'prebid.dap.akadns.net',
'api_version': 'x1',
Expand Down Expand Up @@ -260,6 +268,34 @@ describe('symitriDapRtdProvider', function() {
});
});

describe('dapX2Tokenize', function () {
it('dapX2Tokenize error callback', function () {
let configAsync = JSON.parse(JSON.stringify(sampleX2Config));
let submoduleCallback = dapUtils.dapTokenize(configAsync, sampleIdentity, onDone,
function(token, status, xhr, onDone) {
},
function(xhr, status, error, onDone) {
}
);
let request = server.requests[0];
request.respond(400, responseHeader, JSON.stringify('error'));
expect(submoduleCallback).to.equal(undefined);
});

it('dapX2Tokenize success callback', function () {
let configAsync = JSON.parse(JSON.stringify(sampleX2Config));
let submoduleCallback = dapUtils.dapTokenize(configAsync, sampleIdentity, onDone,
function(token, status, xhr, onDone) {
},
function(xhr, status, error, onDone) {
}
);
let request = server.requests[0];
request.respond(200, responseHeader, JSON.stringify('success'));
expect(submoduleCallback).to.equal(undefined);
});
});

describe('dapTokenize and dapMembership incorrect params', function () {
it('Onerror and config are null', function () {
expect(dapUtils.dapTokenize(null, 'identity', onDone, null, null)).to.be.equal(undefined);
Expand Down

0 comments on commit f246e2e

Please sign in to comment.