Skip to content

Commit

Permalink
Jixie Bid Adapter: change cookie ls names (#8695)
Browse files Browse the repository at this point in the history
* Adapter does not seem capable of supporting advertiserDomains #6650
added response comment and some trivial code.

* removed a blank line at the end of file
added a space behind the // in comments

* in response to comment from reviewer. add the aspect of advertiserdomain in unit tests

* added the code to get the keywords from the meta tags if available.

* changed cookie ls names
  • Loading branch information
jxdeveloper1 authored and ahmadlob committed Jul 27, 2022
1 parent 54e0401 commit 679d996
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
20 changes: 10 additions & 10 deletions modules/jixieBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ function setIds_(clientId, sessionId) {
let expC = (new Date(new Date().setFullYear(new Date().getFullYear() + 1))).toUTCString();
let expS = (new Date(new Date().setMinutes(new Date().getMinutes() + sidTTLMins_))).toUTCString();

storage.setCookie('_jx', clientId, expC, 'None', null);
storage.setCookie('_jx', clientId, expC, 'None', dd);
storage.setCookie('_jxx', clientId, expC, 'None', null);
storage.setCookie('_jxx', clientId, expC, 'None', dd);

storage.setCookie('_jxs', sessionId, expS, 'None', null);
storage.setCookie('_jxs', sessionId, expS, 'None', dd);
storage.setCookie('_jxxs', sessionId, expS, 'None', null);
storage.setCookie('_jxxs', sessionId, expS, 'None', dd);

storage.setDataInLocalStorage('_jx', clientId);
storage.setDataInLocalStorage('_jxs', sessionId);
storage.setDataInLocalStorage('_jxx', clientId);
storage.setDataInLocalStorage('_jxxs', sessionId);
} catch (error) {}
}

Expand All @@ -47,14 +47,14 @@ function fetchIds_() {
session_id_ls: ''
};
try {
let tmp = storage.getCookie('_jx');
let tmp = storage.getCookie('_jxx');
if (tmp) ret.client_id_c = tmp;
tmp = storage.getCookie('_jxs');
tmp = storage.getCookie('_jxxs');
if (tmp) ret.session_id_c = tmp;

tmp = storage.getDataFromLocalStorage('_jx');
tmp = storage.getDataFromLocalStorage('_jxx');
if (tmp) ret.client_id_ls = tmp;
tmp = storage.getDataFromLocalStorage('_jxs');
tmp = storage.getDataFromLocalStorage('_jxxs');
if (tmp) ret.session_id_ls = tmp;
} catch (error) {}
return ret;
Expand Down
16 changes: 8 additions & 8 deletions test/spec/modules/jixieBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,16 @@ describe('jixie Adapter', function () {
let getCookieStub = sinon.stub(storage, 'getCookie');
let getLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
getCookieStub
.withArgs('_jx')
.withArgs('_jxx')
.returns(clientIdTest1_);
getCookieStub
.withArgs('_jxs')
.withArgs('_jxxs')
.returns(sessionIdTest1_);
getLocalStorageStub
.withArgs('_jx')
.withArgs('_jxx')
.returns(clientIdTest1_);
getLocalStorageStub
.withArgs('_jxs')
.withArgs('_jxxs')
.returns(sessionIdTest1_
);
let miscDimsStub = sinon.stub(jixieaux, 'getMiscDims');
Expand Down Expand Up @@ -528,10 +528,10 @@ describe('jixie Adapter', function () {
let setCookieSpy = sinon.spy(storage, 'setCookie');
let setLocalStorageSpy = sinon.spy(storage, 'setDataInLocalStorage');
const result = spec.interpretResponse({body: responseBody_}, requestObj_)
expect(setLocalStorageSpy.calledWith('_jx', '43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);
expect(setLocalStorageSpy.calledWith('_jxs', '1600057934-43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);
expect(setCookieSpy.calledWith('_jxs', '1600057934-43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);
expect(setCookieSpy.calledWith('_jx', '43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);
expect(setLocalStorageSpy.calledWith('_jxx', '43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);
expect(setLocalStorageSpy.calledWith('_jxxs', '1600057934-43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);
expect(setCookieSpy.calledWith('_jxxs', '1600057934-43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);
expect(setCookieSpy.calledWith('_jxx', '43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);

// video ad with vastUrl returned by adserver
expect(result[0].requestId).to.equal('62847e4c696edcb')
Expand Down

0 comments on commit 679d996

Please sign in to comment.