Skip to content

[FSSDK-10934] Cherry picking commits from 5.x.x to master #968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions lib/core/decision_service/index.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ describe('lib/core/decision_service', function() {
);
assert.strictEqual(
buildLogMessageFromArgs(mockLogger.log.args[4]),
'DECISION_SERVICE: Saved variation "control" of experiment "testExperiment" for user "decision_service_user".'
'DECISION_SERVICE: Saved user profile for user "decision_service_user".'
);
});

Expand All @@ -394,6 +394,7 @@ describe('lib/core/decision_service', function() {
optimizely: {},
userId: 'decision_service_user',
});

assert.strictEqual(
'control',
decisionServiceInstance.getVariation(configObj, experiment, user).result
Expand All @@ -402,11 +403,11 @@ describe('lib/core/decision_service', function() {
sinon.assert.calledOnce(bucketerStub); // should still go through with bucketing
assert.strictEqual(
buildLogMessageFromArgs(mockLogger.log.args[0]),
'DECISION_SERVICE: User decision_service_user is not in the forced variation map.'
'DECISION_SERVICE: Error while looking up user profile for user ID "decision_service_user": I am an error.'
);
assert.strictEqual(
buildLogMessageFromArgs(mockLogger.log.args[1]),
'DECISION_SERVICE: Error while looking up user profile for user ID "decision_service_user": I am an error.'
'DECISION_SERVICE: User decision_service_user is not in the forced variation map.'
);
});

Expand Down Expand Up @@ -1281,7 +1282,7 @@ describe('lib/core/decision_service', function() {
reasons: [],
};
experiment = configObj.experimentIdMap['594098'];
getVariationStub = sandbox.stub(decisionServiceInstance, 'getVariation');
getVariationStub = sandbox.stub(decisionServiceInstance, 'resolveVariation');
getVariationStub.returns(fakeDecisionResponse);
getVariationStub.withArgs(configObj, experiment, user).returns(fakeDecisionResponseWithArgs);
});
Expand Down Expand Up @@ -1497,12 +1498,11 @@ describe('lib/core/decision_service', function() {
decisionSource: DECISION_SOURCES.FEATURE_TEST,
};
assert.deepEqual(decision, expectedDecision);
sinon.assert.calledWithExactly(
sinon.assert.calledWith(
getVariationStub,
configObj,
experiment,
user,
{}
);
});
});
Expand All @@ -1515,7 +1515,7 @@ describe('lib/core/decision_service', function() {
optimizely: {},
userId: 'user1',
});
getVariationStub = sandbox.stub(decisionServiceInstance, 'getVariation');
getVariationStub = sandbox.stub(decisionServiceInstance, 'resolveVariation');
getVariationStub.returns(fakeDecisionResponse);
});

Expand Down Expand Up @@ -1554,7 +1554,7 @@ describe('lib/core/decision_service', function() {
result: 'var',
reasons: [],
};
getVariationStub = sandbox.stub(decisionServiceInstance, 'getVariation');
getVariationStub = sandbox.stub(decisionServiceInstance, 'resolveVariation');
getVariationStub.returns(fakeDecisionResponseWithArgs);
getVariationStub.withArgs(configObj, 'exp_with_group', user).returns(fakeDecisionResponseWithArgs);
});
Expand Down Expand Up @@ -1611,7 +1611,7 @@ describe('lib/core/decision_service', function() {
optimizely: {},
userId: 'user1',
});
getVariationStub = sandbox.stub(decisionServiceInstance, 'getVariation');
getVariationStub = sandbox.stub(decisionServiceInstance, 'resolveVariation');
getVariationStub.returns(fakeDecisionResponse);
});

Expand Down Expand Up @@ -1679,6 +1679,7 @@ describe('lib/core/decision_service', function() {
status: 'Not started',
key: '594031',
id: '594031',
isRollout: true,
variations: [
{
id: '594032',
Expand Down Expand Up @@ -1816,6 +1817,7 @@ describe('lib/core/decision_service', function() {
status: 'Not started',
key: '594037',
id: '594037',
isRollout: true,
variations: [
{
id: '594038',
Expand Down Expand Up @@ -2000,6 +2002,7 @@ describe('lib/core/decision_service', function() {
status: 'Not started',
key: '594037',
id: '594037',
isRollout: true,
variations: [
{
id: '594038',
Expand Down Expand Up @@ -2154,6 +2157,7 @@ describe('lib/core/decision_service', function() {
layerId: '599055',
forcedVariations: {},
audienceIds: [],
isRollout: true,
variations: [
{
key: '599057',
Expand Down
Loading
Loading