-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow bidder-specific FPD enrichments
- Loading branch information
Showing
11 changed files
with
77 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {enrichFPDHook} from '../../../modules/consentManagementGpp.js'; | ||
import {gppDataHandler} from '../../../src/adapterManager.js'; | ||
|
||
describe('gpp FPD enrichment', () => { | ||
let sandbox, consent; | ||
beforeEach(() => { | ||
sandbox = sinon.sandbox.create(); | ||
consent = null; | ||
sandbox.stub(gppDataHandler, 'getConsentData').callsFake(() => consent); | ||
}) | ||
|
||
afterEach(() => { | ||
sandbox.restore(); | ||
}) | ||
|
||
function enrich() { | ||
let result; | ||
enrichFPDHook((val) => { | ||
result = val; | ||
}, Promise.resolve({global: {}})); | ||
return result.then(({global}) => global); | ||
} | ||
|
||
it('should add consent data', () => { | ||
consent = { | ||
applicableSections: [1, 2], | ||
gppString: 'ABC' | ||
}; | ||
return enrich().then(ortb2 => { | ||
expect(ortb2.regs.gpp).to.eql('ABC'); | ||
expect(ortb2.regs.gpp_sid).to.eql([1, 2]); | ||
}); | ||
}); | ||
|
||
it('should not run if consent is missing', () => { | ||
return enrich().then(ortb2 => { | ||
expect(ortb2.regs?.gpp).to.not.exist; | ||
expect(ortb2.regs?.gpp_sid).to.not.exist; | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters