Skip to content

Commit 7770664

Browse files
[FSSDK-10934] Cherry picking commits from 5.x.x to master (#968)
1 parent 6105336 commit 7770664

File tree

9 files changed

+475
-184
lines changed

9 files changed

+475
-184
lines changed

lib/core/decision_service/index.tests.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ describe('lib/core/decision_service', function() {
381381
);
382382
assert.strictEqual(
383383
buildLogMessageFromArgs(mockLogger.log.args[4]),
384-
'DECISION_SERVICE: Saved variation "control" of experiment "testExperiment" for user "decision_service_user".'
384+
'DECISION_SERVICE: Saved user profile for user "decision_service_user".'
385385
);
386386
});
387387

@@ -394,6 +394,7 @@ describe('lib/core/decision_service', function() {
394394
optimizely: {},
395395
userId: 'decision_service_user',
396396
});
397+
397398
assert.strictEqual(
398399
'control',
399400
decisionServiceInstance.getVariation(configObj, experiment, user).result
@@ -402,11 +403,11 @@ describe('lib/core/decision_service', function() {
402403
sinon.assert.calledOnce(bucketerStub); // should still go through with bucketing
403404
assert.strictEqual(
404405
buildLogMessageFromArgs(mockLogger.log.args[0]),
405-
'DECISION_SERVICE: User decision_service_user is not in the forced variation map.'
406+
'DECISION_SERVICE: Error while looking up user profile for user ID "decision_service_user": I am an error.'
406407
);
407408
assert.strictEqual(
408409
buildLogMessageFromArgs(mockLogger.log.args[1]),
409-
'DECISION_SERVICE: Error while looking up user profile for user ID "decision_service_user": I am an error.'
410+
'DECISION_SERVICE: User decision_service_user is not in the forced variation map.'
410411
);
411412
});
412413

@@ -1281,7 +1282,7 @@ describe('lib/core/decision_service', function() {
12811282
reasons: [],
12821283
};
12831284
experiment = configObj.experimentIdMap['594098'];
1284-
getVariationStub = sandbox.stub(decisionServiceInstance, 'getVariation');
1285+
getVariationStub = sandbox.stub(decisionServiceInstance, 'resolveVariation');
12851286
getVariationStub.returns(fakeDecisionResponse);
12861287
getVariationStub.withArgs(configObj, experiment, user).returns(fakeDecisionResponseWithArgs);
12871288
});
@@ -1497,12 +1498,11 @@ describe('lib/core/decision_service', function() {
14971498
decisionSource: DECISION_SOURCES.FEATURE_TEST,
14981499
};
14991500
assert.deepEqual(decision, expectedDecision);
1500-
sinon.assert.calledWithExactly(
1501+
sinon.assert.calledWith(
15011502
getVariationStub,
15021503
configObj,
15031504
experiment,
15041505
user,
1505-
{}
15061506
);
15071507
});
15081508
});
@@ -1515,7 +1515,7 @@ describe('lib/core/decision_service', function() {
15151515
optimizely: {},
15161516
userId: 'user1',
15171517
});
1518-
getVariationStub = sandbox.stub(decisionServiceInstance, 'getVariation');
1518+
getVariationStub = sandbox.stub(decisionServiceInstance, 'resolveVariation');
15191519
getVariationStub.returns(fakeDecisionResponse);
15201520
});
15211521

@@ -1554,7 +1554,7 @@ describe('lib/core/decision_service', function() {
15541554
result: 'var',
15551555
reasons: [],
15561556
};
1557-
getVariationStub = sandbox.stub(decisionServiceInstance, 'getVariation');
1557+
getVariationStub = sandbox.stub(decisionServiceInstance, 'resolveVariation');
15581558
getVariationStub.returns(fakeDecisionResponseWithArgs);
15591559
getVariationStub.withArgs(configObj, 'exp_with_group', user).returns(fakeDecisionResponseWithArgs);
15601560
});
@@ -1611,7 +1611,7 @@ describe('lib/core/decision_service', function() {
16111611
optimizely: {},
16121612
userId: 'user1',
16131613
});
1614-
getVariationStub = sandbox.stub(decisionServiceInstance, 'getVariation');
1614+
getVariationStub = sandbox.stub(decisionServiceInstance, 'resolveVariation');
16151615
getVariationStub.returns(fakeDecisionResponse);
16161616
});
16171617

@@ -1679,6 +1679,7 @@ describe('lib/core/decision_service', function() {
16791679
status: 'Not started',
16801680
key: '594031',
16811681
id: '594031',
1682+
isRollout: true,
16821683
variations: [
16831684
{
16841685
id: '594032',
@@ -1816,6 +1817,7 @@ describe('lib/core/decision_service', function() {
18161817
status: 'Not started',
18171818
key: '594037',
18181819
id: '594037',
1820+
isRollout: true,
18191821
variations: [
18201822
{
18211823
id: '594038',
@@ -2000,6 +2002,7 @@ describe('lib/core/decision_service', function() {
20002002
status: 'Not started',
20012003
key: '594037',
20022004
id: '594037',
2005+
isRollout: true,
20032006
variations: [
20042007
{
20052008
id: '594038',
@@ -2154,6 +2157,7 @@ describe('lib/core/decision_service', function() {
21542157
layerId: '599055',
21552158
forcedVariations: {},
21562159
audienceIds: [],
2160+
isRollout: true,
21572161
variations: [
21582162
{
21592163
key: '599057',

0 commit comments

Comments
 (0)