-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Expand file tree
/
Copy pathadtelligentIdSystem_spec.js
More file actions
30 lines (28 loc) · 978 Bytes
/
adtelligentIdSystem_spec.js
File metadata and controls
30 lines (28 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { adtelligentIdModule } from 'modules/adtelligentIdSystem'
import * as ajaxLib from 'src/ajax.js';
const adtUserIdRemoteResponse = { u: 'test1' };
const adtUserIdLocalResponse = 'test2';
describe('AdtelligentId module', function () {
it('gets remote id', function () {
const ajaxBuilderStub = sinon.stub(ajaxLib, 'ajaxBuilder').callsFake(() => {
return (url, cbObj) => {
cbObj.success(JSON.stringify(adtUserIdRemoteResponse))
}
});
const moduleIdCallbackResponse = adtelligentIdModule.getId();
moduleIdCallbackResponse.callback((id) => {
expect(id).to.equal(adtUserIdRemoteResponse.u)
})
ajaxBuilderStub.restore();
})
it('gets id from page context', function () {
window.adtDmp = {
ready: true,
getUID() {
return adtUserIdLocalResponse;
}
}
const moduleIdResponse = adtelligentIdModule.getId();
assert.deepEqual(moduleIdResponse, { id: adtUserIdLocalResponse });
})
})