Skip to content

Commit d20228b

Browse files
[FSSDK-10766] UPS batch processing (#953)
decide & decideForKeys adjustment
1 parent 5a413d3 commit d20228b

File tree

6 files changed

+455
-181
lines changed

6 files changed

+455
-181
lines changed

lib/core/decision_service/index.tests.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2017-2022 Optimizely, Inc. and contributors *
2+
* Copyright 2017-2022,2024 Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -379,7 +379,7 @@ describe('lib/core/decision_service', function() {
379379
);
380380
assert.strictEqual(
381381
buildLogMessageFromArgs(mockLogger.log.args[4]),
382-
'DECISION_SERVICE: Saved variation "control" of experiment "testExperiment" for user "decision_service_user".'
382+
'DECISION_SERVICE: Saved user profile for user "decision_service_user".'
383383
);
384384
});
385385

@@ -392,6 +392,7 @@ describe('lib/core/decision_service', function() {
392392
optimizely: {},
393393
userId: 'decision_service_user',
394394
});
395+
395396
assert.strictEqual(
396397
'control',
397398
decisionServiceInstance.getVariation(configObj, experiment, user).result
@@ -400,11 +401,11 @@ describe('lib/core/decision_service', function() {
400401
sinon.assert.calledOnce(bucketerStub); // should still go through with bucketing
401402
assert.strictEqual(
402403
buildLogMessageFromArgs(mockLogger.log.args[0]),
403-
'DECISION_SERVICE: User decision_service_user is not in the forced variation map.'
404+
'DECISION_SERVICE: Error while looking up user profile for user ID "decision_service_user": I am an error.'
404405
);
405406
assert.strictEqual(
406407
buildLogMessageFromArgs(mockLogger.log.args[1]),
407-
'DECISION_SERVICE: Error while looking up user profile for user ID "decision_service_user": I am an error.'
408+
'DECISION_SERVICE: User decision_service_user is not in the forced variation map.'
408409
);
409410
});
410411

@@ -1277,7 +1278,7 @@ describe('lib/core/decision_service', function() {
12771278
reasons: [],
12781279
};
12791280
experiment = configObj.experimentIdMap['594098'];
1280-
getVariationStub = sandbox.stub(decisionServiceInstance, 'getVariation');
1281+
getVariationStub = sandbox.stub(decisionServiceInstance, 'resolveVariation');
12811282
getVariationStub.returns(fakeDecisionResponse);
12821283
getVariationStub.withArgs(configObj, experiment, user).returns(fakeDecisionResponseWithArgs);
12831284
});
@@ -1493,12 +1494,11 @@ describe('lib/core/decision_service', function() {
14931494
decisionSource: DECISION_SOURCES.FEATURE_TEST,
14941495
};
14951496
assert.deepEqual(decision, expectedDecision);
1496-
sinon.assert.calledWithExactly(
1497+
sinon.assert.calledWith(
14971498
getVariationStub,
14981499
configObj,
14991500
experiment,
15001501
user,
1501-
{}
15021502
);
15031503
});
15041504
});
@@ -1511,7 +1511,7 @@ describe('lib/core/decision_service', function() {
15111511
optimizely: {},
15121512
userId: 'user1',
15131513
});
1514-
getVariationStub = sandbox.stub(decisionServiceInstance, 'getVariation');
1514+
getVariationStub = sandbox.stub(decisionServiceInstance, 'resolveVariation');
15151515
getVariationStub.returns(fakeDecisionResponse);
15161516
});
15171517

@@ -1550,7 +1550,7 @@ describe('lib/core/decision_service', function() {
15501550
result: 'var',
15511551
reasons: [],
15521552
};
1553-
getVariationStub = sandbox.stub(decisionServiceInstance, 'getVariation');
1553+
getVariationStub = sandbox.stub(decisionServiceInstance, 'resolveVariation');
15541554
getVariationStub.returns(fakeDecisionResponseWithArgs);
15551555
getVariationStub.withArgs(configObj, 'exp_with_group', user).returns(fakeDecisionResponseWithArgs);
15561556
});
@@ -1607,7 +1607,7 @@ describe('lib/core/decision_service', function() {
16071607
optimizely: {},
16081608
userId: 'user1',
16091609
});
1610-
getVariationStub = sandbox.stub(decisionServiceInstance, 'getVariation');
1610+
getVariationStub = sandbox.stub(decisionServiceInstance, 'resolveVariation');
16111611
getVariationStub.returns(fakeDecisionResponse);
16121612
});
16131613

0 commit comments

Comments
 (0)