Skip to content

Commit cf8c517

Browse files
Refactor test function syntax to use arrow functions for consistency
1 parent 7f83681 commit cf8c517

31 files changed

+139
-142
lines changed

src/evaluator/__tests__/evaluate-feature.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const mockStorage = {
2525
}
2626
};
2727

28-
test('EVALUATOR / should return label exception, treatment control and config null on error', async function () {
28+
test('EVALUATOR / should return label exception, treatment control and config null on error', async () => {
2929
const expectedOutput = {
3030
treatment: 'control',
3131
label: EXCEPTION,
@@ -46,7 +46,7 @@ test('EVALUATOR / should return label exception, treatment control and config nu
4646
});
4747

4848

49-
test('EVALUATOR / should return right label, treatment and config if storage returns without errors.', async function () {
49+
test('EVALUATOR / should return right label, treatment and config if storage returns without errors.', async () => {
5050
const expectedOutput = {
5151
treatment: 'on', label: 'in segment all',
5252
config: '{color:\'black\'}', changeNumber: 1487277320548

src/evaluator/__tests__/evaluate-features.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const mockStorage = {
4242
}
4343
};
4444

45-
test('EVALUATOR - Multiple evaluations at once / should return label exception, treatment control and config null on error', async function () {
45+
test('EVALUATOR - Multiple evaluations at once / should return label exception, treatment control and config null on error', async () => {
4646
const expectedOutput = {
4747
throw_exception: {
4848
treatment: 'control',
@@ -65,7 +65,7 @@ test('EVALUATOR - Multiple evaluations at once / should return label exception,
6565
});
6666

6767

68-
test('EVALUATOR - Multiple evaluations at once / should return right labels, treatments and configs if storage returns without errors.', async function () {
68+
test('EVALUATOR - Multiple evaluations at once / should return right labels, treatments and configs if storage returns without errors.', async () => {
6969
const expectedOutput = {
7070
config: {
7171
treatment: 'on', label: 'in segment all',

src/evaluator/combiners/__tests__/and.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { andCombinerContext } from '../and';
22
import { loggerMock } from '../../../logger/__tests__/sdkLogger.mock';
33

4-
test('COMBINER AND / should always return true', async function () {
4+
test('COMBINER AND / should always return true', async () => {
55

66
let AND = andCombinerContext(loggerMock, [() => true, () => true, () => true]);
77

88
expect(await AND('always true')).toBe(true); // should always return true
99
});
1010

11-
test('COMBINER AND / should always return false', async function () {
11+
test('COMBINER AND / should always return false', async () => {
1212

1313
let AND = andCombinerContext(loggerMock, [() => true, () => true, () => false]);
1414

src/evaluator/combiners/__tests__/ifelseif.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { ifElseIfCombinerContext } from '../ifelseif';
33
import { loggerMock } from '../../../logger/__tests__/sdkLogger.mock';
44

5-
test('IF ELSE IF COMBINER / should correctly propagate context parameters and predicates returns value', async function () {
5+
test('IF ELSE IF COMBINER / should correctly propagate context parameters and predicates returns value', async () => {
66
let inputKey = 'sample';
77
let inputSeed = 1234;
88
let inputAttributes = {};
@@ -20,10 +20,9 @@ test('IF ELSE IF COMBINER / should correctly propagate context parameters and pr
2020
let ifElseIfEvaluator = ifElseIfCombinerContext(loggerMock, predicates);
2121

2222
expect(await ifElseIfEvaluator(inputKey, inputSeed, inputAttributes) === evaluationResult).toBe(true);
23-
console.log(`evaluator should return ${evaluationResult}`);
2423
});
2524

26-
test('IF ELSE IF COMBINER / should stop evaluating when one matcher return a treatment', async function () {
25+
test('IF ELSE IF COMBINER / should stop evaluating when one matcher return a treatment', async () => {
2726
let predicates = [
2827
function undef() {
2928
return undefined;
@@ -41,7 +40,7 @@ test('IF ELSE IF COMBINER / should stop evaluating when one matcher return a tre
4140
expect(await ifElseIfEvaluator()).toBe('exclude'); // exclude treatment found
4241
});
4342

44-
test('IF ELSE IF COMBINER / should return undefined if there is none matching rule', async function () {
43+
test('IF ELSE IF COMBINER / should return undefined if there is none matching rule', async () => {
4544
const predicates = [
4645
function undef() {
4746
return undefined;

src/evaluator/matchers/__tests__/all.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { matcherFactory } from '..';
33
import { IMatcher, IMatcherDto } from '../../types';
44
import { loggerMock } from '../../../logger/__tests__/sdkLogger.mock';
55

6-
test('MATCHER ALL_KEYS / should always return true', function () {
6+
test('MATCHER ALL_KEYS / should always return true', () => {
77
const matcher = matcherFactory(loggerMock, {
88
type: matcherTypes.ALL_KEYS,
99
value: undefined

src/evaluator/matchers/__tests__/between.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { matcherFactory } from '..';
33
import { IMatcher, IMatcherDto } from '../../types';
44
import { loggerMock } from '../../../logger/__tests__/sdkLogger.mock';
55

6-
test('MATCHER BETWEEN / should return true ONLY when the value is between 10 and 20', function () {
6+
test('MATCHER BETWEEN / should return true ONLY when the value is between 10 and 20', () => {
77
const matcher = matcherFactory(loggerMock, {
88
negate: false,
99
type: matcherTypes.BETWEEN,

src/evaluator/matchers/__tests__/boolean.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { matcherFactory } from '..';
33
import { IMatcher, IMatcherDto } from '../../types';
44
import { loggerMock } from '../../../logger/__tests__/sdkLogger.mock';
55

6-
test('MATCHER BOOLEAN / should return true ONLY when the value is true', function () {
6+
test('MATCHER BOOLEAN / should return true ONLY when the value is true', () => {
77
const matcher = matcherFactory(loggerMock, {
88
type: matcherTypes.EQUAL_TO_BOOLEAN,
99
value: true

src/evaluator/matchers/__tests__/cont_all.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { matcherFactory } from '..';
33
import { IMatcher, IMatcherDto } from '../../types';
44
import { loggerMock } from '../../../logger/__tests__/sdkLogger.mock';
55

6-
test('MATCHER CONTAINS_ALL_OF_SET / should return true ONLY when value contains all of set ["update", "add"]', function () {
6+
test('MATCHER CONTAINS_ALL_OF_SET / should return true ONLY when value contains all of set ["update", "add"]', () => {
77
const matcher = matcherFactory(loggerMock, {
88
negate: false,
99
type: matcherTypes.CONTAINS_ALL_OF_SET,

src/evaluator/matchers/__tests__/cont_any.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { matcherFactory } from '..';
33
import { IMatcher, IMatcherDto } from '../../types';
44
import { loggerMock } from '../../../logger/__tests__/sdkLogger.mock';
55

6-
test('MATCHER CONTAINS_ANY_OF_SET / should return true ONLY when value contains any of set ["update", "add"]', function () {
6+
test('MATCHER CONTAINS_ANY_OF_SET / should return true ONLY when value contains any of set ["update", "add"]', () => {
77
const matcher = matcherFactory(loggerMock, {
88
negate: false,
99
type: matcherTypes.CONTAINS_ANY_OF_SET,

src/evaluator/matchers/__tests__/cont_str.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { matcherFactory } from '..';
33
import { IMatcher, IMatcherDto } from '../../types';
44
import { loggerMock } from '../../../logger/__tests__/sdkLogger.mock';
55

6-
test('MATCHER CONTAINS_STRING / should return true ONLY when the value is contained in ["roni", "bad", "ar"]', function () {
6+
test('MATCHER CONTAINS_STRING / should return true ONLY when the value is contained in ["roni", "bad", "ar"]', () => {
77
const matcher = matcherFactory(loggerMock, {
88
negate: false,
99
type: matcherTypes.CONTAINS_STRING,

0 commit comments

Comments
 (0)