Skip to content

Commit

Permalink
fix broken tests due to "encoded" base64 logic (prebid#6268)
Browse files Browse the repository at this point in the history
  • Loading branch information
harpere authored and stsepelin committed May 28, 2021
1 parent 0b38663 commit 4c3e79d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/spec/modules/parrableIdSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ describe('Parrable ID System', function() {
let logErrorStub;
let callbackSpy = sinon.spy();

let decodeBase64UrlSafe = function (encBase64) {
const DEC = {
'-': '+',
'_': '/',
'.': '='
};
return encBase64.replace(/[-_.]/g, (m) => DEC[m]);
}

beforeEach(function() {
logErrorStub = sinon.stub(utils, 'logError');
callbackSpy.resetHistory();
Expand All @@ -98,7 +107,7 @@ describe('Parrable ID System', function() {

let request = server.requests[0];
let queryParams = utils.parseQS(request.url.split('?')[1]);
let data = JSON.parse(atob(queryParams.data));
let data = JSON.parse(atob(decodeBase64UrlSafe(queryParams.data)));

expect(getIdResult.callback).to.be.a('function');
expect(request.url).to.contain('h.parrable.com');
Expand Down

0 comments on commit 4c3e79d

Please sign in to comment.