Skip to content

Commit

Permalink
SharedID module: update tests to assert on behavior rather than logs (p…
Browse files Browse the repository at this point in the history
…rebid#7738)

Update tests that fail spuriously: prebid#7355
I was not able to reproduce the failures, but in debugging I ruled out the possibility of module loading order and I believe the most likely culprit is other tests asynchronously calling `utils.logInfo` that sometimes happen in-between these tests' setup and assertions.

This may not be the real issue, but IMO testing log messages makes little sense anyway, so I updated them to test the actual SOT behavior.
  • Loading branch information
dgirardi authored and Chris Pabst committed Jan 10, 2022
1 parent ec4dd23 commit 71bd059
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/spec/modules/sharedIdSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ describe('SharedId System', function () {
expect(callbackSpy.calledOnce).to.be.true;
expect(callbackSpy.lastCall.lastArg).to.equal(UUID);
});
it('should log message if coppa is set', function () {
it('should abort if coppa is set', function () {
coppaDataHandlerDataStub.returns('true');
sharedIdSystemSubmodule.getId({});
expect(utils.logInfo.args[0][0]).to.exist.and.to.equal('PubCommonId: IDs not provided for coppa requests, exiting PubCommonId');
const result = sharedIdSystemSubmodule.getId({});
expect(result).to.be.undefined;
});
});
describe('SharedId System extendId()', function () {
Expand Down Expand Up @@ -85,10 +85,10 @@ describe('SharedId System', function () {
let pubcommId = sharedIdSystemSubmodule.extendId(config, undefined, 'TestId').id;
expect(pubcommId).to.equal('TestId');
});
it('should log message if coppa is set', function () {
it('should abort if coppa is set', function () {
coppaDataHandlerDataStub.returns('true');
sharedIdSystemSubmodule.extendId({}, undefined, 'TestId');
expect(utils.logInfo.args[0][0]).to.exist.and.to.equal('PubCommonId: IDs not provided for coppa requests, exiting PubCommonId');
const result = sharedIdSystemSubmodule.extendId({params: {extend: true}}, undefined, 'TestId');
expect(result).to.be.undefined;
});
});
});

0 comments on commit 71bd059

Please sign in to comment.