Skip to content

Commit

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

Update tests that fail spuriously: #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 Nov 18, 2021
1 parent 898f1f6 commit 8f6f3b0
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 8f6f3b0

Please sign in to comment.