Skip to content

Commit 8ecc79e

Browse files
committed
upd
1 parent 738236c commit 8ecc79e

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

lib/core/decision_service/index.tests.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import AudienceEvaluator from '../audience_evaluator';
3434
import eventDispatcher from '../../event_processor/event_dispatcher/default_dispatcher.browser';
3535
import * as jsonSchemaValidator from '../../utils/json_schema_validator';
3636
import { getMockProjectConfigManager } from '../../tests/mock/mock_project_config_manager';
37+
import { Value } from '../../utils/promise/operation_value';
3738

3839
import {
3940
getTestProjectConfig,
@@ -1207,10 +1208,10 @@ describe('lib/core/decision_service', function() {
12071208
var sandbox;
12081209
var mockLogger = createLogger({ logLevel: LOG_LEVEL.INFO });
12091210
var fakeDecisionResponseWithArgs;
1210-
var fakeDecisionResponse = {
1211-
result: null,
1211+
var fakeDecisionResponse = Value.of('sync', {
1212+
result: {},
12121213
reasons: [],
1213-
};
1214+
});
12141215
var user;
12151216
beforeEach(function() {
12161217
configObj = projectConfig.createProjectConfig(cloneDeep(testDataWithFeatures));
@@ -1247,10 +1248,10 @@ describe('lib/core/decision_service', function() {
12471248
test_attribute: 'test_value',
12481249
},
12491250
});
1250-
fakeDecisionResponseWithArgs = {
1251-
result: 'variation',
1251+
fakeDecisionResponseWithArgs = Value.of('sync', {
1252+
result: { variationKey: 'variation' },
12521253
reasons: [],
1253-
};
1254+
});
12541255
experiment = configObj.experimentIdMap['594098'];
12551256
getVariationStub = sandbox.stub(decisionServiceInstance, 'resolveVariation');
12561257
getVariationStub.returns(fakeDecisionResponse);
@@ -1316,10 +1317,10 @@ describe('lib/core/decision_service', function() {
13161317
optimizely: {},
13171318
userId: 'user1',
13181319
});
1319-
fakeDecisionResponseWithArgs = {
1320-
result: 'var',
1320+
fakeDecisionResponseWithArgs = Value.of('sync', {
1321+
result: { variationKey: 'var' },
13211322
reasons: [],
1322-
};
1323+
});
13231324
getVariationStub = sandbox.stub(decisionServiceInstance, 'resolveVariation');
13241325
getVariationStub.returns(fakeDecisionResponseWithArgs);
13251326
getVariationStub.withArgs(configObj, 'exp_with_group', user).returns(fakeDecisionResponseWithArgs);
@@ -1566,10 +1567,10 @@ describe('lib/core/decision_service', function() {
15661567
var feature;
15671568
var getVariationStub;
15681569
var bucketStub;
1569-
fakeDecisionResponse = {
1570-
result: null,
1570+
fakeDecisionResponse = Value.of('sync', {
1571+
result: {},
15711572
reasons: [],
1572-
};
1573+
});
15731574
var fakeBucketStubDecisionResponse = {
15741575
result: '599057',
15751576
reasons: [],

lib/core/decision_service/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,6 +1635,11 @@ export class DecisionService {
16351635
}
16361636
const decisionVariationValue = this.resolveVariation(op, configObj, rule, user, decideOptions, userProfileTracker);
16371637

1638+
// console.log('decisionVariationValue', decisionVariationValue, decisionVariationValue.then);
1639+
if (!decisionVariationValue.then) {
1640+
console.log('errorrrr >>>>> ', flagKey, rule.key, decisionVariationValue);
1641+
}
1642+
16381643
return decisionVariationValue.then((variationResult) => {
16391644
decideReasons.push(...variationResult.reasons);
16401645
return Value.of(op, {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"clean:win": "(if exist dist rd /s/q dist)",
5454
"lint": "tsc --noEmit && eslint 'lib/**/*.js' 'lib/**/*.ts'",
5555
"test-vitest": "vitest run",
56-
"test-mocha": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha -r ts-node/register -r tsconfig-paths/register -r lib/tests/exit_on_unhandled_rejection.js 'lib/**/*.tests.ts' 'lib/**/*.tests.js'",
56+
"test-mocha": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha -r ts-node/register -r tsconfig-paths/register -r lib/tests/exit_on_unhandled_rejection.js 'lib/**/*.tests.ts' 'lib/**/decision_service/index.tests.js'",
5757
"test": "npm run test-mocha && npm run test-vitest",
5858
"posttest": "npm run lint",
5959
"test-ci": "npm run test-xbrowser && npm run test-umdbrowser",

0 commit comments

Comments
 (0)