Skip to content

Commit 99b7a59

Browse files
committed
type fix
1 parent aa4d61f commit 99b7a59

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/core/audience_evaluator/index.spec.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const audiencesById: {
104104

105105

106106
describe('lib/core/audience_evaluator', () => {
107-
let audienceEvaluator;
107+
let audienceEvaluator: AudienceEvaluator;
108108

109109
beforeEach(() => {
110110
mockLogger = getMockLogger();
@@ -117,7 +117,7 @@ describe('lib/core/audience_evaluator', () => {
117117
describe('APIs', () => {
118118
describe('with default condition evaluator', () => {
119119
beforeEach(() => {
120-
audienceEvaluator = vi.mocked(createAudienceEvaluator);
120+
audienceEvaluator = createAudienceEvaluator({});
121121
});
122122
describe('evaluate', () => {
123123
it('should return true if there are no audiences', () => {
@@ -280,7 +280,7 @@ describe('lib/core/audience_evaluator', () => {
280280
});
281281

282282
describe('Audience evaluation logging', () => {
283-
let mockCustomAttributeConditionEvaluator;
283+
let mockCustomAttributeConditionEvaluator: ReturnType<typeof vi.fn>;
284284

285285
beforeEach(() => {
286286
mockCustomAttributeConditionEvaluator = vi.fn();
@@ -299,7 +299,7 @@ describe('lib/core/audience_evaluator', () => {
299299
return leafEvaluator(conditions[1]);
300300
});
301301

302-
mockCustomAttributeConditionEvaluator.returns(null);
302+
mockCustomAttributeConditionEvaluator.mockReturnValue(null);
303303
const userAttributes = { device_model: 5.5 };
304304
const user = getMockUserContext(userAttributes);
305305

@@ -326,7 +326,7 @@ describe('lib/core/audience_evaluator', () => {
326326
return leafEvaluator(conditions[1]);
327327
});
328328

329-
mockCustomAttributeConditionEvaluator.returns(true);
329+
mockCustomAttributeConditionEvaluator.mockReturnValue(true);
330330

331331
const userAttributes = { device_model: 'iphone' };
332332
const user = getMockUserContext(userAttributes);
@@ -352,7 +352,7 @@ describe('lib/core/audience_evaluator', () => {
352352
return leafEvaluator(conditions[1]);
353353
});
354354

355-
mockCustomAttributeConditionEvaluator.returns(false);
355+
mockCustomAttributeConditionEvaluator.mockReturnValue(false);
356356

357357
const userAttributes = { device_model: 'android' };
358358
const user = getMockUserContext(userAttributes);
@@ -384,7 +384,8 @@ describe('lib/core/audience_evaluator', () => {
384384
};
385385
audienceEvaluator = createAudienceEvaluator({
386386
special_condition_type: {
387-
evaluate: (condition, user) => {
387+
evaluate: (condition: any, user: any) => {
388+
// @ts-ignore
388389
const result = mockEnvironment[condition.value] && user.getAttributes()[condition.match] > 0;
389390
return result;
390391
},

0 commit comments

Comments
 (0)