Skip to content

Commit 1c19944

Browse files
[FSSDK-11071] minor update
1 parent 191e2c5 commit 1c19944

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

lib/project_config/project_config.spec.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ import {
2929
VARIABLE_KEY_NOT_IN_DATAFILE,
3030
FEATURE_NOT_IN_DATAFILE,
3131
UNABLE_TO_CAST_VALUE,
32-
} from '../error_messages';
33-
import exp from 'constants';
32+
} from 'error_message';
3433
import { VariableType } from '../shared_types';
3534
import { OptimizelyError } from '../error/optimizly_error';
36-
import { J } from 'vitest/dist/chunks/environment.0M5R1SX_.js';
3735

3836
const createLogger = (...args: any) => ({
3937
debug: () => {},
@@ -53,7 +51,7 @@ describe('createProjectConfig', () => {
5351
const testData: Record<string, any> = testDatafile.getTestProjectConfig();
5452
configObj = projectConfig.createProjectConfig(testData as JSON);
5553

56-
forEach(testData.audiences, audience => {
54+
forEach(testData.audiences, (audience: any) => {
5755
audience.conditions = JSON.parse(audience.conditions);
5856
});
5957

@@ -80,14 +78,14 @@ describe('createProjectConfig', () => {
8078
expect(configObj.groupIdMap).toEqual(expectedGroupIdMap);
8179

8280
const expectedExperiments = testData.experiments.slice();
83-
forEach(configObj.groupIdMap, (group, groupId) => {
84-
forEach(group.experiments, experiment => {
81+
forEach(configObj.groupIdMap, (group: any, groupId: any) => {
82+
forEach(group.experiments, (experiment: any) => {
8583
experiment.groupId = groupId;
8684
expectedExperiments.push(experiment);
8785
});
8886
});
8987

90-
forEach(expectedExperiments, experiment => {
88+
forEach(expectedExperiments, (experiment: any) => {
9189
experiment.variationKeyMap = fns.keyBy(experiment.variations, 'key');
9290
});
9391

@@ -1049,7 +1047,7 @@ describe('tryCreatingProjectConfig', () => {
10491047
vi.restoreAllMocks();
10501048
});
10511049

1052-
it('returns a project config object created by createProjectConfig when all validation is applied and there are no errors', () => {
1050+
it('should return a project config object created by createProjectConfig when all validation is applied and there are no errors', () => {
10531051
const configDatafile = {
10541052
foo: 'bar',
10551053
experiments: [{ key: 'a' }, { key: 'b' }],
@@ -1077,7 +1075,7 @@ describe('tryCreatingProjectConfig', () => {
10771075
expect(result).toMatchObject(configObj);
10781076
});
10791077

1080-
it('throws an error when validateDatafile throws', function() {
1078+
it('should throw an error when validateDatafile throws', function() {
10811079
vi.spyOn(configValidator, 'validateDatafile').mockImplementationOnce(() => {
10821080
throw new Error();
10831081
});
@@ -1092,11 +1090,11 @@ describe('tryCreatingProjectConfig', () => {
10921090
).toThrowError();
10931091
});
10941092

1095-
it('throws an error when jsonSchemaValidator.validate throws', function() {
1093+
it('should throw an error when jsonSchemaValidator.validate throws', function() {
10961094
vi.spyOn(configValidator, 'validateDatafile').mockReturnValueOnce(true);
10971095
mockJsonSchemaValidator.mockImplementationOnce(() => {
10981096
throw new Error();
1099-
})
1097+
});
11001098

11011099
expect(() =>
11021100
projectConfig.tryCreatingProjectConfig({
@@ -1107,7 +1105,7 @@ describe('tryCreatingProjectConfig', () => {
11071105
).toThrowError();
11081106
});
11091107

1110-
it('skips json validation when jsonSchemaValidator is not provided', function() {
1108+
it('should skip json validation when jsonSchemaValidator is not provided', function() {
11111109
const configDatafile = {
11121110
foo: 'bar',
11131111
experiments: [{ key: 'a' }, { key: 'b' }],

package-lock.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
"@rollup/plugin-commonjs": "^11.0.2",
120120
"@rollup/plugin-node-resolve": "^7.1.1",
121121
"@types/chai": "^4.2.11",
122+
"@types/lodash": "^4.17.15",
122123
"@types/mocha": "^5.2.7",
123124
"@types/nise": "^1.4.0",
124125
"@types/node": "^18.7.18",

0 commit comments

Comments
 (0)