@featurevisor/sdk 1.35.3 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +2 -381
  3. package/coverage/clover.xml +707 -645
  4. package/coverage/coverage-final.json +11 -9
  5. package/coverage/lcov-report/{segments.ts.html → bucketer.ts.html} +155 -77
  6. package/coverage/lcov-report/child.ts.html +940 -0
  7. package/coverage/lcov-report/conditions.ts.html +107 -158
  8. package/coverage/lcov-report/datafileReader.ts.html +763 -103
  9. package/coverage/lcov-report/emitter.ts.html +77 -59
  10. package/coverage/lcov-report/evaluate.ts.html +689 -416
  11. package/coverage/lcov-report/events.ts.html +334 -0
  12. package/coverage/lcov-report/helpers.ts.html +184 -0
  13. package/coverage/lcov-report/{bucket.ts.html → hooks.ts.html} +86 -239
  14. package/coverage/lcov-report/index.html +119 -89
  15. package/coverage/lcov-report/instance.ts.html +341 -773
  16. package/coverage/lcov-report/logger.ts.html +64 -64
  17. package/coverage/lcov.info +1433 -1226
  18. package/dist/bucketer.d.ts +11 -0
  19. package/dist/child.d.ts +26 -0
  20. package/dist/compareVersions.d.ts +4 -0
  21. package/dist/conditions.d.ts +4 -4
  22. package/dist/datafileReader.d.ts +26 -6
  23. package/dist/emitter.d.ts +8 -9
  24. package/dist/evaluate.d.ts +31 -29
  25. package/dist/events.d.ts +5 -0
  26. package/dist/helpers.d.ts +5 -0
  27. package/dist/hooks.d.ts +45 -0
  28. package/dist/index.d.ts +3 -2
  29. package/dist/index.js +1 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +1 -1
  32. package/dist/index.mjs.gz +0 -0
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/instance.d.ts +40 -72
  35. package/dist/logger.d.ts +6 -5
  36. package/dist/murmurhash.d.ts +1 -0
  37. package/jest.config.js +2 -0
  38. package/lib/bucketer.d.ts +11 -0
  39. package/lib/child.d.ts +26 -0
  40. package/lib/compareVersions.d.ts +4 -0
  41. package/lib/conditions.d.ts +4 -4
  42. package/lib/datafileReader.d.ts +26 -6
  43. package/lib/emitter.d.ts +8 -9
  44. package/lib/evaluate.d.ts +31 -29
  45. package/lib/events.d.ts +5 -0
  46. package/lib/helpers.d.ts +5 -0
  47. package/lib/hooks.d.ts +45 -0
  48. package/lib/index.d.ts +3 -2
  49. package/lib/instance.d.ts +40 -72
  50. package/lib/logger.d.ts +6 -5
  51. package/lib/murmurhash.d.ts +1 -0
  52. package/package.json +3 -5
  53. package/src/bucketer.spec.ts +165 -0
  54. package/src/bucketer.ts +84 -0
  55. package/src/child.spec.ts +267 -0
  56. package/src/child.ts +285 -0
  57. package/src/compareVersions.ts +93 -0
  58. package/src/conditions.spec.ts +563 -353
  59. package/src/conditions.ts +46 -63
  60. package/src/datafileReader.spec.ts +396 -84
  61. package/src/datafileReader.ts +280 -60
  62. package/src/emitter.spec.ts +27 -86
  63. package/src/emitter.ts +38 -32
  64. package/src/evaluate.ts +349 -258
  65. package/src/events.spec.ts +154 -0
  66. package/src/events.ts +83 -0
  67. package/src/helpers.ts +33 -0
  68. package/src/hooks.ts +88 -0
  69. package/src/index.ts +3 -2
  70. package/src/instance.spec.ts +305 -489
  71. package/src/instance.ts +247 -391
  72. package/src/logger.spec.ts +212 -134
  73. package/src/logger.ts +36 -36
  74. package/src/murmurhash.ts +71 -0
  75. package/coverage/lcov-report/feature.ts.html +0 -508
  76. package/dist/bucket.d.ts +0 -30
  77. package/dist/feature.d.ts +0 -16
  78. package/dist/segments.d.ts +0 -5
  79. package/lib/bucket.d.ts +0 -30
  80. package/lib/feature.d.ts +0 -16
  81. package/lib/segments.d.ts +0 -5
  82. package/src/bucket.spec.ts +0 -37
  83. package/src/bucket.ts +0 -139
  84. package/src/feature.ts +0 -141
  85. package/src/segments.spec.ts +0 -468
  86. package/src/segments.ts +0 -58
@@ -1,13 +1,36 @@
1
- import { Condition } from "@featurevisor/types";
1
+ import type { Condition } from "@featurevisor/types";
2
2
 
3
- import { allConditionsAreMatched } from "./conditions";
4
3
  import { createLogger } from "./logger";
4
+ import { DatafileReader } from "./datafileReader";
5
5
 
6
6
  describe("sdk: Conditions", function () {
7
7
  const logger = createLogger();
8
+ const datafileReader = new DatafileReader({
9
+ datafile: {
10
+ schemaVersion: "2.0",
11
+ revision: "1",
12
+ segments: {},
13
+ features: {},
14
+ },
15
+ logger,
16
+ });
8
17
 
9
18
  it("should be a function", function () {
10
- expect(typeof allConditionsAreMatched).toEqual("function");
19
+ expect(typeof datafileReader.allConditionsAreMatched).toEqual("function");
20
+ });
21
+
22
+ it("should match all via *", function () {
23
+ // match
24
+ const conditions: Condition = "*";
25
+ expect(datafileReader.allConditionsAreMatched(conditions, { browser_type: "chrome" })).toEqual(
26
+ true,
27
+ );
28
+
29
+ // not match
30
+ const conditions2: Condition = "blah";
31
+ expect(datafileReader.allConditionsAreMatched(conditions2, { browser_type: "chrome" })).toEqual(
32
+ false,
33
+ );
11
34
  });
12
35
 
13
36
  describe("operators", function () {
@@ -21,10 +44,38 @@ describe("sdk: Conditions", function () {
21
44
  ];
22
45
 
23
46
  // match
24
- expect(allConditionsAreMatched(conditions, { browser_type: "chrome" }, logger)).toEqual(true);
47
+ expect(
48
+ datafileReader.allConditionsAreMatched(conditions, { browser_type: "chrome" }),
49
+ ).toEqual(true);
25
50
 
26
51
  // not match
27
- expect(allConditionsAreMatched(conditions, { browser_type: "firefox" }, logger)).toEqual(
52
+ expect(
53
+ datafileReader.allConditionsAreMatched(conditions, { browser_type: "firefox" }),
54
+ ).toEqual(false);
55
+ });
56
+
57
+ it("should match with operator: equals with dot separated path", function () {
58
+ const conditions: Condition[] = [
59
+ {
60
+ attribute: "browser.type",
61
+ operator: "equals",
62
+ value: "chrome",
63
+ },
64
+ ];
65
+
66
+ // match
67
+ expect(
68
+ datafileReader.allConditionsAreMatched(conditions, { browser: { type: "chrome" } }),
69
+ ).toEqual(true);
70
+
71
+ // not match
72
+ expect(
73
+ datafileReader.allConditionsAreMatched(conditions, { browser: { type: "firefox" } }),
74
+ ).toEqual(false);
75
+ expect(
76
+ datafileReader.allConditionsAreMatched(conditions, { browser: { blah: "firefox" } }),
77
+ ).toEqual(false);
78
+ expect(datafileReader.allConditionsAreMatched(conditions, { browser: "firefox" })).toEqual(
28
79
  false,
29
80
  );
30
81
  });
@@ -39,31 +90,124 @@ describe("sdk: Conditions", function () {
39
90
  ];
40
91
 
41
92
  // match
42
- expect(allConditionsAreMatched(conditions, { browser_type: "firefox" }, logger)).toEqual(
43
- true,
44
- );
93
+ expect(
94
+ datafileReader.allConditionsAreMatched(conditions, { browser_type: "firefox" }),
95
+ ).toEqual(true);
96
+
97
+ // not match
98
+ expect(
99
+ datafileReader.allConditionsAreMatched(conditions, { browser_type: "chrome" }),
100
+ ).toEqual(false);
101
+ });
102
+
103
+ it("should match with operator: equals", function () {
104
+ const conditions: Condition[] = [
105
+ {
106
+ attribute: "browser_type",
107
+ operator: "equals",
108
+ value: "chrome",
109
+ },
110
+ ];
111
+
112
+ // match
113
+ expect(
114
+ datafileReader.allConditionsAreMatched(conditions, { browser_type: "chrome" }),
115
+ ).toEqual(true);
45
116
 
46
117
  // not match
47
- expect(allConditionsAreMatched(conditions, { browser_type: "chrome" }, logger)).toEqual(
118
+ expect(
119
+ datafileReader.allConditionsAreMatched(conditions, { browser_type: "firefox" }),
120
+ ).toEqual(false);
121
+ });
122
+
123
+ it("should match with operator: exists", function () {
124
+ const conditions: Condition[] = [
125
+ {
126
+ attribute: "browser_type",
127
+ operator: "exists",
128
+ },
129
+ ];
130
+
131
+ // match
132
+ expect(
133
+ datafileReader.allConditionsAreMatched(conditions, { browser_type: "firefox" }),
134
+ ).toEqual(true);
135
+
136
+ // not match
137
+ expect(
138
+ datafileReader.allConditionsAreMatched(conditions, { not_browser_type: "chrome" }),
139
+ ).toEqual(false);
140
+ });
141
+
142
+ it("should match with operator: exists (dot separated path)", function () {
143
+ const conditions: Condition[] = [
144
+ {
145
+ attribute: "browser.name",
146
+ operator: "exists",
147
+ },
148
+ ];
149
+
150
+ // match
151
+ expect(
152
+ datafileReader.allConditionsAreMatched(conditions, { browser: { name: "chrome" } }),
153
+ ).toEqual(true);
154
+
155
+ // not match
156
+ expect(datafileReader.allConditionsAreMatched(conditions, { browser: "chrome" })).toEqual(
157
+ false,
158
+ );
159
+ expect(
160
+ datafileReader.allConditionsAreMatched(conditions, { browser: { version: "1.2.3" } }),
161
+ ).toEqual(false);
162
+ expect(datafileReader.allConditionsAreMatched(conditions, { version: "1.2.3" })).toEqual(
48
163
  false,
49
164
  );
50
165
  });
51
166
 
52
- it("should match with operator: startsWith", function () {
167
+ it("should match with operator: notExists", function () {
53
168
  const conditions: Condition[] = [
54
169
  {
55
170
  attribute: "name",
56
- operator: "startsWith",
57
- value: "Hello",
171
+ operator: "notExists",
58
172
  },
59
173
  ];
60
174
 
61
175
  // match
62
- expect(allConditionsAreMatched(conditions, { name: "Hello World" }, logger)).toEqual(true);
63
- expect(allConditionsAreMatched(conditions, { name: "Hello Universe" }, logger)).toEqual(true);
176
+ expect(
177
+ datafileReader.allConditionsAreMatched(conditions, { not_name: "Hello World" }),
178
+ ).toEqual(true);
179
+ expect(
180
+ datafileReader.allConditionsAreMatched(conditions, { not_name: "Hello Universe" }),
181
+ ).toEqual(true);
64
182
 
65
183
  // not match
66
- expect(allConditionsAreMatched(conditions, { name: "Hi World" }, logger)).toEqual(false);
184
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hi World" })).toEqual(
185
+ false,
186
+ );
187
+ });
188
+
189
+ it("should match with operator: notExists (with dot separated path)", function () {
190
+ const conditions: Condition[] = [
191
+ {
192
+ attribute: "browser.name",
193
+ operator: "notExists",
194
+ },
195
+ ];
196
+
197
+ // match
198
+ expect(
199
+ datafileReader.allConditionsAreMatched(conditions, {
200
+ browser: { not_name: "Hello World" },
201
+ }),
202
+ ).toEqual(true);
203
+ expect(
204
+ datafileReader.allConditionsAreMatched(conditions, { not_name: "Hello Universe" }),
205
+ ).toEqual(true);
206
+
207
+ // not match
208
+ expect(
209
+ datafileReader.allConditionsAreMatched(conditions, { browser: { name: "Chrome" } }),
210
+ ).toEqual(false);
67
211
  });
68
212
 
69
213
  it("should match with operator: endsWith", function () {
@@ -76,11 +220,59 @@ describe("sdk: Conditions", function () {
76
220
  ];
77
221
 
78
222
  // match
79
- expect(allConditionsAreMatched(conditions, { name: "Hello World" }, logger)).toEqual(true);
80
- expect(allConditionsAreMatched(conditions, { name: "Hi World" }, logger)).toEqual(true);
223
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hello World" })).toEqual(
224
+ true,
225
+ );
226
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hi World" })).toEqual(
227
+ true,
228
+ );
229
+
230
+ // not match
231
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hi Universe" })).toEqual(
232
+ false,
233
+ );
234
+ });
235
+
236
+ it("should match with operator: includes", function () {
237
+ const conditions: Condition[] = [
238
+ {
239
+ attribute: "permissions",
240
+ operator: "includes",
241
+ value: "write",
242
+ },
243
+ ];
244
+
245
+ // match
246
+ expect(
247
+ datafileReader.allConditionsAreMatched(conditions, { permissions: ["read", "write"] }),
248
+ ).toEqual(true);
249
+
250
+ // not match
251
+ expect(datafileReader.allConditionsAreMatched(conditions, { permissions: ["read"] })).toEqual(
252
+ false,
253
+ );
254
+ });
255
+
256
+ it("should match with operator: notIncludes", function () {
257
+ const conditions: Condition[] = [
258
+ {
259
+ attribute: "permissions",
260
+ operator: "notIncludes",
261
+ value: "write",
262
+ },
263
+ ];
264
+
265
+ // match
266
+ expect(
267
+ datafileReader.allConditionsAreMatched(conditions, { permissions: ["read", "admin"] }),
268
+ ).toEqual(true);
81
269
 
82
270
  // not match
83
- expect(allConditionsAreMatched(conditions, { name: "Hi Universe" }, logger)).toEqual(false);
271
+ expect(
272
+ datafileReader.allConditionsAreMatched(conditions, {
273
+ permissions: ["read", "write", "admin"],
274
+ }),
275
+ ).toEqual(false);
84
276
  });
85
277
 
86
278
  it("should match with operator: contains", function () {
@@ -93,11 +285,17 @@ describe("sdk: Conditions", function () {
93
285
  ];
94
286
 
95
287
  // match
96
- expect(allConditionsAreMatched(conditions, { name: "Hello World" }, logger)).toEqual(true);
97
- expect(allConditionsAreMatched(conditions, { name: "Yo! Hello!" }, logger)).toEqual(true);
288
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hello World" })).toEqual(
289
+ true,
290
+ );
291
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Yo! Hello!" })).toEqual(
292
+ true,
293
+ );
98
294
 
99
295
  // not match
100
- expect(allConditionsAreMatched(conditions, { name: "Hi World" }, logger)).toEqual(false);
296
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hi World" })).toEqual(
297
+ false,
298
+ );
101
299
  });
102
300
 
103
301
  it("should match with operator: notContains", function () {
@@ -110,11 +308,121 @@ describe("sdk: Conditions", function () {
110
308
  ];
111
309
 
112
310
  // match
113
- expect(allConditionsAreMatched(conditions, { name: "Hi World" }, logger)).toEqual(true);
311
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hi World" })).toEqual(
312
+ true,
313
+ );
314
+
315
+ // not match
316
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hello World" })).toEqual(
317
+ false,
318
+ );
319
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Yo! Hello!" })).toEqual(
320
+ false,
321
+ );
322
+ });
323
+
324
+ it("should match with operator: matches", function () {
325
+ const conditions: Condition[] = [
326
+ {
327
+ attribute: "name",
328
+ operator: "matches",
329
+ value: "^[a-zA-Z]{2,}$",
330
+ },
331
+ ];
332
+
333
+ // match
334
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hello" })).toEqual(true);
335
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Helloooooo" })).toEqual(
336
+ true,
337
+ );
338
+
339
+ // not match
340
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hello World" })).toEqual(
341
+ false,
342
+ );
343
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hell123" })).toEqual(
344
+ false,
345
+ );
346
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "123" })).toEqual(false);
347
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: 123 })).toEqual(false);
348
+ });
349
+
350
+ it("should match with operator: matches with regexFlags", function () {
351
+ const conditions: Condition[] = [
352
+ {
353
+ attribute: "name",
354
+ operator: "matches",
355
+ value: "^[a-zA-Z]{2,}$",
356
+ regexFlags: "i",
357
+ },
358
+ ];
359
+
360
+ // match
361
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hello" })).toEqual(true);
362
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Helloooooo" })).toEqual(
363
+ true,
364
+ );
365
+
366
+ // not match
367
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hello World" })).toEqual(
368
+ false,
369
+ );
370
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hell123" })).toEqual(
371
+ false,
372
+ );
373
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "123" })).toEqual(false);
374
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: 123 })).toEqual(false);
375
+ });
376
+
377
+ it("should match with operator: notMatches", function () {
378
+ const conditions: Condition[] = [
379
+ {
380
+ attribute: "name",
381
+ operator: "notMatches",
382
+ value: "^[a-zA-Z]{2,}$",
383
+ },
384
+ ];
385
+
386
+ // match
387
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hi World" })).toEqual(
388
+ true,
389
+ );
390
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "123" })).toEqual(true);
391
+
392
+ // @NOTE: improve later
393
+ // expect(datafileReader.allConditionsAreMatched(conditions, { name: 123 }, )).toEqual(true);
394
+
395
+ // not match
396
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hello" })).toEqual(false);
397
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hellooooooo" })).toEqual(
398
+ false,
399
+ );
400
+ });
401
+
402
+ it("should match with operator: notMatches with regexFlags", function () {
403
+ const conditions: Condition[] = [
404
+ {
405
+ attribute: "name",
406
+ operator: "notMatches",
407
+ value: "^[a-zA-Z]{2,}$",
408
+ regexFlags: "i",
409
+ },
410
+ ];
411
+
412
+ // match
413
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hi World" })).toEqual(
414
+ true,
415
+ );
416
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "123" })).toEqual(true);
417
+
418
+ // @NOTE: improve later
419
+ // expect(datafileReader.allConditionsAreMatched(conditions, { name: 123 }, )).toEqual(true);
114
420
 
115
421
  // not match
116
- expect(allConditionsAreMatched(conditions, { name: "Hello World" }, logger)).toEqual(false);
117
- expect(allConditionsAreMatched(conditions, { name: "Yo! Hello!" }, logger)).toEqual(false);
422
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hello" })).toEqual(false);
423
+ expect(datafileReader.allConditionsAreMatched(conditions, { name: "Hellooooooo" })).toEqual(
424
+ false,
425
+ );
118
426
  });
119
427
 
120
428
  it("should match with operator: in", function () {
@@ -127,16 +435,20 @@ describe("sdk: Conditions", function () {
127
435
  ];
128
436
 
129
437
  // match
130
- expect(allConditionsAreMatched(conditions, { browser_type: "chrome" }, logger)).toEqual(true);
131
- expect(allConditionsAreMatched(conditions, { browser_type: "firefox" }, logger)).toEqual(
132
- true,
133
- );
438
+ expect(
439
+ datafileReader.allConditionsAreMatched(conditions, { browser_type: "chrome" }),
440
+ ).toEqual(true);
441
+ expect(
442
+ datafileReader.allConditionsAreMatched(conditions, { browser_type: "firefox" }),
443
+ ).toEqual(true);
134
444
 
135
445
  // not match
136
- expect(allConditionsAreMatched(conditions, { browser_type: "edge" }, logger)).toEqual(false);
137
- expect(allConditionsAreMatched(conditions, { browser_type: "safari" }, logger)).toEqual(
446
+ expect(datafileReader.allConditionsAreMatched(conditions, { browser_type: "edge" })).toEqual(
138
447
  false,
139
448
  );
449
+ expect(
450
+ datafileReader.allConditionsAreMatched(conditions, { browser_type: "safari" }),
451
+ ).toEqual(false);
140
452
  });
141
453
 
142
454
  it("should match with operator: notIn", function () {
@@ -149,16 +461,20 @@ describe("sdk: Conditions", function () {
149
461
  ];
150
462
 
151
463
  // match
152
- expect(allConditionsAreMatched(conditions, { browser_type: "edge" }, logger)).toEqual(true);
153
- expect(allConditionsAreMatched(conditions, { browser_type: "safari" }, logger)).toEqual(true);
464
+ expect(datafileReader.allConditionsAreMatched(conditions, { browser_type: "edge" })).toEqual(
465
+ true,
466
+ );
467
+ expect(
468
+ datafileReader.allConditionsAreMatched(conditions, { browser_type: "safari" }),
469
+ ).toEqual(true);
154
470
 
155
471
  // not match
156
- expect(allConditionsAreMatched(conditions, { browser_type: "chrome" }, logger)).toEqual(
157
- false,
158
- );
159
- expect(allConditionsAreMatched(conditions, { browser_type: "firefox" }, logger)).toEqual(
160
- false,
161
- );
472
+ expect(
473
+ datafileReader.allConditionsAreMatched(conditions, { browser_type: "chrome" }),
474
+ ).toEqual(false);
475
+ expect(
476
+ datafileReader.allConditionsAreMatched(conditions, { browser_type: "firefox" }),
477
+ ).toEqual(false);
162
478
  });
163
479
 
164
480
  it("should match with operator: greaterThan", function () {
@@ -171,10 +487,10 @@ describe("sdk: Conditions", function () {
171
487
  ];
172
488
 
173
489
  // match
174
- expect(allConditionsAreMatched(conditions, { age: 19 }, logger)).toEqual(true);
490
+ expect(datafileReader.allConditionsAreMatched(conditions, { age: 19 })).toEqual(true);
175
491
 
176
492
  // not match
177
- expect(allConditionsAreMatched(conditions, { age: 17 }, logger)).toEqual(false);
493
+ expect(datafileReader.allConditionsAreMatched(conditions, { age: 17 })).toEqual(false);
178
494
  });
179
495
 
180
496
  it("should match with operator: greaterThanOrEquals", function () {
@@ -187,12 +503,12 @@ describe("sdk: Conditions", function () {
187
503
  ];
188
504
 
189
505
  // match
190
- expect(allConditionsAreMatched(conditions, { age: 18 }, logger)).toEqual(true);
191
- expect(allConditionsAreMatched(conditions, { age: 19 }, logger)).toEqual(true);
506
+ expect(datafileReader.allConditionsAreMatched(conditions, { age: 18 })).toEqual(true);
507
+ expect(datafileReader.allConditionsAreMatched(conditions, { age: 19 })).toEqual(true);
192
508
 
193
509
  // not match
194
- expect(allConditionsAreMatched(conditions, { age: 17 }, logger)).toEqual(false);
195
- expect(allConditionsAreMatched(conditions, { age: 16 }, logger)).toEqual(false);
510
+ expect(datafileReader.allConditionsAreMatched(conditions, { age: 17 })).toEqual(false);
511
+ expect(datafileReader.allConditionsAreMatched(conditions, { age: 16 })).toEqual(false);
196
512
  });
197
513
 
198
514
  it("should match with operator: lessThan", function () {
@@ -205,10 +521,10 @@ describe("sdk: Conditions", function () {
205
521
  ];
206
522
 
207
523
  // match
208
- expect(allConditionsAreMatched(conditions, { age: 17 }, logger)).toEqual(true);
524
+ expect(datafileReader.allConditionsAreMatched(conditions, { age: 17 })).toEqual(true);
209
525
 
210
526
  // not match
211
- expect(allConditionsAreMatched(conditions, { age: 19 }, logger)).toEqual(false);
527
+ expect(datafileReader.allConditionsAreMatched(conditions, { age: 19 })).toEqual(false);
212
528
  });
213
529
 
214
530
  it("should match with operator: lessThanOrEquals", function () {
@@ -221,12 +537,12 @@ describe("sdk: Conditions", function () {
221
537
  ];
222
538
 
223
539
  // match
224
- expect(allConditionsAreMatched(conditions, { age: 17 }, logger)).toEqual(true);
225
- expect(allConditionsAreMatched(conditions, { age: 18 }, logger)).toEqual(true);
540
+ expect(datafileReader.allConditionsAreMatched(conditions, { age: 17 })).toEqual(true);
541
+ expect(datafileReader.allConditionsAreMatched(conditions, { age: 18 })).toEqual(true);
226
542
 
227
543
  // not match
228
- expect(allConditionsAreMatched(conditions, { age: 19 }, logger)).toEqual(false);
229
- expect(allConditionsAreMatched(conditions, { age: 20 }, logger)).toEqual(false);
544
+ expect(datafileReader.allConditionsAreMatched(conditions, { age: 19 })).toEqual(false);
545
+ expect(datafileReader.allConditionsAreMatched(conditions, { age: 20 })).toEqual(false);
230
546
  });
231
547
 
232
548
  it("should match with operator: semverEquals", function () {
@@ -239,10 +555,14 @@ describe("sdk: Conditions", function () {
239
555
  ];
240
556
 
241
557
  // match
242
- expect(allConditionsAreMatched(conditions, { version: "1.0.0" }, logger)).toEqual(true);
558
+ expect(datafileReader.allConditionsAreMatched(conditions, { version: "1.0.0" })).toEqual(
559
+ true,
560
+ );
243
561
 
244
562
  // not match
245
- expect(allConditionsAreMatched(conditions, { version: "2.0.0" }, logger)).toEqual(false);
563
+ expect(datafileReader.allConditionsAreMatched(conditions, { version: "2.0.0" })).toEqual(
564
+ false,
565
+ );
246
566
  });
247
567
 
248
568
  it("should match with operator: semverNotEquals", function () {
@@ -255,10 +575,14 @@ describe("sdk: Conditions", function () {
255
575
  ];
256
576
 
257
577
  // match
258
- expect(allConditionsAreMatched(conditions, { version: "2.0.0" }, logger)).toEqual(true);
578
+ expect(datafileReader.allConditionsAreMatched(conditions, { version: "2.0.0" })).toEqual(
579
+ true,
580
+ );
259
581
 
260
582
  // not match
261
- expect(allConditionsAreMatched(conditions, { version: "1.0.0" }, logger)).toEqual(false);
583
+ expect(datafileReader.allConditionsAreMatched(conditions, { version: "1.0.0" })).toEqual(
584
+ false,
585
+ );
262
586
  });
263
587
 
264
588
  it("should match with operator: semverGreaterThan", function () {
@@ -271,10 +595,14 @@ describe("sdk: Conditions", function () {
271
595
  ];
272
596
 
273
597
  // match
274
- expect(allConditionsAreMatched(conditions, { version: "2.0.0" }, logger)).toEqual(true);
598
+ expect(datafileReader.allConditionsAreMatched(conditions, { version: "2.0.0" })).toEqual(
599
+ true,
600
+ );
275
601
 
276
602
  // not match
277
- expect(allConditionsAreMatched(conditions, { version: "0.9.0" }, logger)).toEqual(false);
603
+ expect(datafileReader.allConditionsAreMatched(conditions, { version: "0.9.0" })).toEqual(
604
+ false,
605
+ );
278
606
  });
279
607
 
280
608
  it("should match with operator: semverGreaterThanOrEquals", function () {
@@ -287,11 +615,17 @@ describe("sdk: Conditions", function () {
287
615
  ];
288
616
 
289
617
  // match
290
- expect(allConditionsAreMatched(conditions, { version: "1.0.0" }, logger)).toEqual(true);
291
- expect(allConditionsAreMatched(conditions, { version: "2.0.0" }, logger)).toEqual(true);
618
+ expect(datafileReader.allConditionsAreMatched(conditions, { version: "1.0.0" })).toEqual(
619
+ true,
620
+ );
621
+ expect(datafileReader.allConditionsAreMatched(conditions, { version: "2.0.0" })).toEqual(
622
+ true,
623
+ );
292
624
 
293
625
  // not match
294
- expect(allConditionsAreMatched(conditions, { version: "0.9.0" }, logger)).toEqual(false);
626
+ expect(datafileReader.allConditionsAreMatched(conditions, { version: "0.9.0" })).toEqual(
627
+ false,
628
+ );
295
629
  });
296
630
 
297
631
  it("should match with operator: semverLessThan", function () {
@@ -304,10 +638,14 @@ describe("sdk: Conditions", function () {
304
638
  ];
305
639
 
306
640
  // match
307
- expect(allConditionsAreMatched(conditions, { version: "0.9.0" }, logger)).toEqual(true);
641
+ expect(datafileReader.allConditionsAreMatched(conditions, { version: "0.9.0" })).toEqual(
642
+ true,
643
+ );
308
644
 
309
645
  // not match
310
- expect(allConditionsAreMatched(conditions, { version: "1.1.0" }, logger)).toEqual(false);
646
+ expect(datafileReader.allConditionsAreMatched(conditions, { version: "1.1.0" })).toEqual(
647
+ false,
648
+ );
311
649
  });
312
650
 
313
651
  it("should match with operator: semverLessThanOrEquals", function () {
@@ -320,10 +658,14 @@ describe("sdk: Conditions", function () {
320
658
  ];
321
659
 
322
660
  // match
323
- expect(allConditionsAreMatched(conditions, { version: "1.0.0" }, logger)).toEqual(true);
661
+ expect(datafileReader.allConditionsAreMatched(conditions, { version: "1.0.0" })).toEqual(
662
+ true,
663
+ );
324
664
 
325
665
  // not match
326
- expect(allConditionsAreMatched(conditions, { version: "1.1.0" }, logger)).toEqual(false);
666
+ expect(datafileReader.allConditionsAreMatched(conditions, { version: "1.1.0" })).toEqual(
667
+ false,
668
+ );
327
669
  });
328
670
 
329
671
  it("should match with operator: before", function () {
@@ -336,19 +678,23 @@ describe("sdk: Conditions", function () {
336
678
  ];
337
679
 
338
680
  // match
339
- expect(allConditionsAreMatched(conditions, { date: "2023-05-12T00:00:00Z" }, logger)).toEqual(
340
- true,
341
- );
342
681
  expect(
343
- allConditionsAreMatched(conditions, { date: new Date("2023-05-12T00:00:00Z") }, logger),
682
+ datafileReader.allConditionsAreMatched(conditions, { date: "2023-05-12T00:00:00Z" }),
683
+ ).toEqual(true);
684
+ expect(
685
+ datafileReader.allConditionsAreMatched(conditions, {
686
+ date: new Date("2023-05-12T00:00:00Z"),
687
+ }),
344
688
  ).toEqual(true);
345
689
 
346
690
  // not match
347
- expect(allConditionsAreMatched(conditions, { date: "2023-05-14T00:00:00Z" }, logger)).toEqual(
348
- false,
349
- );
350
691
  expect(
351
- allConditionsAreMatched(conditions, { date: new Date("2023-05-14T00:00:00Z") }, logger),
692
+ datafileReader.allConditionsAreMatched(conditions, { date: "2023-05-14T00:00:00Z" }),
693
+ ).toEqual(false);
694
+ expect(
695
+ datafileReader.allConditionsAreMatched(conditions, {
696
+ date: new Date("2023-05-14T00:00:00Z"),
697
+ }),
352
698
  ).toEqual(false);
353
699
  });
354
700
 
@@ -362,19 +708,23 @@ describe("sdk: Conditions", function () {
362
708
  ];
363
709
 
364
710
  // match
365
- expect(allConditionsAreMatched(conditions, { date: "2023-05-14T00:00:00Z" }, logger)).toEqual(
366
- true,
367
- );
368
711
  expect(
369
- allConditionsAreMatched(conditions, { date: new Date("2023-05-14T00:00:00Z") }, logger),
712
+ datafileReader.allConditionsAreMatched(conditions, { date: "2023-05-14T00:00:00Z" }),
713
+ ).toEqual(true);
714
+ expect(
715
+ datafileReader.allConditionsAreMatched(conditions, {
716
+ date: new Date("2023-05-14T00:00:00Z"),
717
+ }),
370
718
  ).toEqual(true);
371
719
 
372
720
  // not match
373
- expect(allConditionsAreMatched(conditions, { date: "2023-05-12T00:00:00Z" }, logger)).toEqual(
374
- false,
375
- );
376
721
  expect(
377
- allConditionsAreMatched(conditions, { date: new Date("2023-05-12T00:00:00Z") }, logger),
722
+ datafileReader.allConditionsAreMatched(conditions, { date: "2023-05-12T00:00:00Z" }),
723
+ ).toEqual(false);
724
+ expect(
725
+ datafileReader.allConditionsAreMatched(conditions, {
726
+ date: new Date("2023-05-12T00:00:00Z"),
727
+ }),
378
728
  ).toEqual(false);
379
729
  });
380
730
  });
@@ -391,13 +741,9 @@ describe("sdk: Conditions", function () {
391
741
 
392
742
  // match
393
743
  expect(
394
- allConditionsAreMatched(
395
- conditions[0],
396
- {
397
- browser_type: "chrome",
398
- },
399
- logger,
400
- ),
744
+ datafileReader.allConditionsAreMatched(conditions[0], {
745
+ browser_type: "chrome",
746
+ }),
401
747
  ).toEqual(true);
402
748
  });
403
749
 
@@ -412,13 +758,9 @@ describe("sdk: Conditions", function () {
412
758
 
413
759
  // match
414
760
  expect(
415
- allConditionsAreMatched(
416
- conditions,
417
- {
418
- browser_type: "chrome",
419
- },
420
- logger,
421
- ),
761
+ datafileReader.allConditionsAreMatched(conditions, {
762
+ browser_type: "chrome",
763
+ }),
422
764
  ).toEqual(true);
423
765
  });
424
766
 
@@ -427,24 +769,16 @@ describe("sdk: Conditions", function () {
427
769
 
428
770
  // match
429
771
  expect(
430
- allConditionsAreMatched(
431
- conditions,
432
- {
433
- browser_type: "chrome",
434
- },
435
- logger,
436
- ),
772
+ datafileReader.allConditionsAreMatched(conditions, {
773
+ browser_type: "chrome",
774
+ }),
437
775
  ).toEqual(true);
438
776
 
439
777
  // not match
440
778
  expect(
441
- allConditionsAreMatched(
442
- conditions,
443
- {
444
- browser_type: "firefox",
445
- },
446
- logger,
447
- ),
779
+ datafileReader.allConditionsAreMatched(conditions, {
780
+ browser_type: "firefox",
781
+ }),
448
782
  ).toEqual(true);
449
783
  });
450
784
 
@@ -459,14 +793,10 @@ describe("sdk: Conditions", function () {
459
793
 
460
794
  // match
461
795
  expect(
462
- allConditionsAreMatched(
463
- conditions,
464
- {
465
- browser_type: "chrome",
466
- browser_version: "1.0",
467
- },
468
- logger,
469
- ),
796
+ datafileReader.allConditionsAreMatched(conditions, {
797
+ browser_type: "chrome",
798
+ browser_version: "1.0",
799
+ }),
470
800
  ).toEqual(true);
471
801
  });
472
802
 
@@ -486,15 +816,11 @@ describe("sdk: Conditions", function () {
486
816
 
487
817
  // match
488
818
  expect(
489
- allConditionsAreMatched(
490
- conditions,
491
- {
492
- browser_type: "chrome",
493
- browser_version: "1.0",
494
- foo: "bar",
495
- },
496
- logger,
497
- ),
819
+ datafileReader.allConditionsAreMatched(conditions, {
820
+ browser_type: "chrome",
821
+ browser_version: "1.0",
822
+ foo: "bar",
823
+ }),
498
824
  ).toEqual(true);
499
825
  });
500
826
  });
@@ -515,24 +841,16 @@ describe("sdk: Conditions", function () {
515
841
 
516
842
  // match
517
843
  expect(
518
- allConditionsAreMatched(
519
- conditions,
520
- {
521
- browser_type: "chrome",
522
- },
523
- logger,
524
- ),
844
+ datafileReader.allConditionsAreMatched(conditions, {
845
+ browser_type: "chrome",
846
+ }),
525
847
  ).toEqual(true);
526
848
 
527
849
  // not match
528
850
  expect(
529
- allConditionsAreMatched(
530
- conditions,
531
- {
532
- browser_type: "firefox",
533
- },
534
- logger,
535
- ),
851
+ datafileReader.allConditionsAreMatched(conditions, {
852
+ browser_type: "firefox",
853
+ }),
536
854
  ).toEqual(false);
537
855
  });
538
856
 
@@ -556,25 +874,17 @@ describe("sdk: Conditions", function () {
556
874
 
557
875
  // match
558
876
  expect(
559
- allConditionsAreMatched(
560
- conditions,
561
- {
562
- browser_type: "chrome",
563
- browser_version: "1.0",
564
- },
565
- logger,
566
- ),
877
+ datafileReader.allConditionsAreMatched(conditions, {
878
+ browser_type: "chrome",
879
+ browser_version: "1.0",
880
+ }),
567
881
  ).toEqual(true);
568
882
 
569
883
  // not match
570
884
  expect(
571
- allConditionsAreMatched(
572
- conditions,
573
- {
574
- browser_type: "chrome",
575
- },
576
- logger,
577
- ),
885
+ datafileReader.allConditionsAreMatched(conditions, {
886
+ browser_type: "chrome",
887
+ }),
578
888
  ).toEqual(false);
579
889
  });
580
890
  });
@@ -595,13 +905,9 @@ describe("sdk: Conditions", function () {
595
905
 
596
906
  // match
597
907
  expect(
598
- allConditionsAreMatched(
599
- conditions,
600
- {
601
- browser_type: "chrome",
602
- },
603
- logger,
604
- ),
908
+ datafileReader.allConditionsAreMatched(conditions, {
909
+ browser_type: "chrome",
910
+ }),
605
911
  ).toEqual(true);
606
912
  });
607
913
 
@@ -625,24 +931,16 @@ describe("sdk: Conditions", function () {
625
931
 
626
932
  // match
627
933
  expect(
628
- allConditionsAreMatched(
629
- conditions,
630
- {
631
- browser_version: "1.0",
632
- },
633
- logger,
634
- ),
934
+ datafileReader.allConditionsAreMatched(conditions, {
935
+ browser_version: "1.0",
936
+ }),
635
937
  ).toEqual(true);
636
938
 
637
939
  // not match
638
940
  expect(
639
- allConditionsAreMatched(
640
- conditions,
641
- {
642
- browser_type: "firefox",
643
- },
644
- logger,
645
- ),
941
+ datafileReader.allConditionsAreMatched(conditions, {
942
+ browser_type: "firefox",
943
+ }),
646
944
  ).toEqual(false);
647
945
  });
648
946
  });
@@ -663,24 +961,16 @@ describe("sdk: Conditions", function () {
663
961
 
664
962
  // match
665
963
  expect(
666
- allConditionsAreMatched(
667
- conditions,
668
- {
669
- browser_type: "firefox",
670
- },
671
- logger,
672
- ),
964
+ datafileReader.allConditionsAreMatched(conditions, {
965
+ browser_type: "firefox",
966
+ }),
673
967
  ).toEqual(true);
674
968
 
675
969
  // not match
676
970
  expect(
677
- allConditionsAreMatched(
678
- conditions,
679
- {
680
- browser_type: "chrome",
681
- },
682
- logger,
683
- ),
971
+ datafileReader.allConditionsAreMatched(conditions, {
972
+ browser_type: "chrome",
973
+ }),
684
974
  ).toEqual(false);
685
975
  });
686
976
 
@@ -704,45 +994,29 @@ describe("sdk: Conditions", function () {
704
994
 
705
995
  // match
706
996
  expect(
707
- allConditionsAreMatched(
708
- conditions,
709
- {
710
- browser_type: "firefox",
711
- browser_version: "2.0",
712
- },
713
- logger,
714
- ),
997
+ datafileReader.allConditionsAreMatched(conditions, {
998
+ browser_type: "firefox",
999
+ browser_version: "2.0",
1000
+ }),
715
1001
  ).toEqual(true);
716
1002
  expect(
717
- allConditionsAreMatched(
718
- conditions,
719
- {
720
- browser_type: "chrome",
721
- },
722
- logger,
723
- ),
1003
+ datafileReader.allConditionsAreMatched(conditions, {
1004
+ browser_type: "chrome",
1005
+ }),
724
1006
  ).toEqual(true);
725
1007
  expect(
726
- allConditionsAreMatched(
727
- conditions,
728
- {
729
- browser_type: "chrome",
730
- browser_version: "2.0",
731
- },
732
- logger,
733
- ),
1008
+ datafileReader.allConditionsAreMatched(conditions, {
1009
+ browser_type: "chrome",
1010
+ browser_version: "2.0",
1011
+ }),
734
1012
  ).toEqual(true);
735
1013
 
736
1014
  // not match
737
1015
  expect(
738
- allConditionsAreMatched(
739
- conditions,
740
- {
741
- browser_type: "chrome",
742
- browser_version: "1.0",
743
- },
744
- logger,
745
- ),
1016
+ datafileReader.allConditionsAreMatched(conditions, {
1017
+ browser_type: "chrome",
1018
+ browser_version: "1.0",
1019
+ }),
746
1020
  ).toEqual(false);
747
1021
  });
748
1022
  });
@@ -777,47 +1051,31 @@ describe("sdk: Conditions", function () {
777
1051
 
778
1052
  // match
779
1053
  expect(
780
- allConditionsAreMatched(
781
- conditions,
782
- {
783
- browser_type: "chrome",
784
- browser_version: "1.0",
785
- },
786
- logger,
787
- ),
1054
+ datafileReader.allConditionsAreMatched(conditions, {
1055
+ browser_type: "chrome",
1056
+ browser_version: "1.0",
1057
+ }),
788
1058
  ).toEqual(true);
789
1059
 
790
1060
  expect(
791
- allConditionsAreMatched(
792
- conditions,
793
- {
794
- browser_type: "chrome",
795
- browser_version: "2.0",
796
- },
797
- logger,
798
- ),
1061
+ datafileReader.allConditionsAreMatched(conditions, {
1062
+ browser_type: "chrome",
1063
+ browser_version: "2.0",
1064
+ }),
799
1065
  ).toEqual(true);
800
1066
 
801
1067
  // not match
802
1068
  expect(
803
- allConditionsAreMatched(
804
- conditions,
805
- {
806
- browser_type: "chrome",
807
- browser_version: "3.0",
808
- },
809
- logger,
810
- ),
1069
+ datafileReader.allConditionsAreMatched(conditions, {
1070
+ browser_type: "chrome",
1071
+ browser_version: "3.0",
1072
+ }),
811
1073
  ).toEqual(false);
812
1074
 
813
1075
  expect(
814
- allConditionsAreMatched(
815
- conditions,
816
- {
817
- browser_version: "2.0",
818
- },
819
- logger,
820
- ),
1076
+ datafileReader.allConditionsAreMatched(conditions, {
1077
+ browser_version: "2.0",
1078
+ }),
821
1079
  ).toEqual(false);
822
1080
  });
823
1081
 
@@ -855,50 +1113,34 @@ describe("sdk: Conditions", function () {
855
1113
 
856
1114
  // match
857
1115
  expect(
858
- allConditionsAreMatched(
859
- conditions,
860
- {
861
- country: "nl",
862
- browser_type: "chrome",
863
- browser_version: "1.0",
864
- },
865
- logger,
866
- ),
1116
+ datafileReader.allConditionsAreMatched(conditions, {
1117
+ country: "nl",
1118
+ browser_type: "chrome",
1119
+ browser_version: "1.0",
1120
+ }),
867
1121
  ).toEqual(true);
868
1122
 
869
1123
  expect(
870
- allConditionsAreMatched(
871
- conditions,
872
- {
873
- country: "nl",
874
- browser_type: "chrome",
875
- browser_version: "2.0",
876
- },
877
- logger,
878
- ),
1124
+ datafileReader.allConditionsAreMatched(conditions, {
1125
+ country: "nl",
1126
+ browser_type: "chrome",
1127
+ browser_version: "2.0",
1128
+ }),
879
1129
  ).toEqual(true);
880
1130
 
881
1131
  // not match
882
1132
  expect(
883
- allConditionsAreMatched(
884
- conditions,
885
- {
886
- browser_type: "chrome",
887
- browser_version: "3.0",
888
- },
889
- logger,
890
- ),
1133
+ datafileReader.allConditionsAreMatched(conditions, {
1134
+ browser_type: "chrome",
1135
+ browser_version: "3.0",
1136
+ }),
891
1137
  ).toEqual(false);
892
1138
 
893
1139
  expect(
894
- allConditionsAreMatched(
895
- conditions,
896
- {
897
- country: "us",
898
- browser_version: "2.0",
899
- },
900
- logger,
901
- ),
1140
+ datafileReader.allConditionsAreMatched(conditions, {
1141
+ country: "us",
1142
+ browser_version: "2.0",
1143
+ }),
902
1144
  ).toEqual(false);
903
1145
  });
904
1146
 
@@ -931,49 +1173,33 @@ describe("sdk: Conditions", function () {
931
1173
 
932
1174
  // match
933
1175
  expect(
934
- allConditionsAreMatched(
935
- conditions,
936
- {
937
- browser_type: "chrome",
938
- browser_version: "2.0",
939
- },
940
- logger,
941
- ),
1176
+ datafileReader.allConditionsAreMatched(conditions, {
1177
+ browser_type: "chrome",
1178
+ browser_version: "2.0",
1179
+ }),
942
1180
  ).toEqual(true);
943
1181
 
944
1182
  expect(
945
- allConditionsAreMatched(
946
- conditions,
947
- {
948
- browser_type: "firefox",
949
- device_type: "mobile",
950
- orientation: "portrait",
951
- },
952
- logger,
953
- ),
1183
+ datafileReader.allConditionsAreMatched(conditions, {
1184
+ browser_type: "firefox",
1185
+ device_type: "mobile",
1186
+ orientation: "portrait",
1187
+ }),
954
1188
  ).toEqual(true);
955
1189
 
956
1190
  // not match
957
1191
  expect(
958
- allConditionsAreMatched(
959
- conditions,
960
- {
961
- browser_type: "firefox",
962
- browser_version: "2.0",
963
- },
964
- logger,
965
- ),
1192
+ datafileReader.allConditionsAreMatched(conditions, {
1193
+ browser_type: "firefox",
1194
+ browser_version: "2.0",
1195
+ }),
966
1196
  ).toEqual(false);
967
1197
 
968
1198
  expect(
969
- allConditionsAreMatched(
970
- conditions,
971
- {
972
- browser_type: "firefox",
973
- device_type: "desktop",
974
- },
975
- logger,
976
- ),
1199
+ datafileReader.allConditionsAreMatched(conditions, {
1200
+ browser_type: "firefox",
1201
+ device_type: "desktop",
1202
+ }),
977
1203
  ).toEqual(false);
978
1204
  });
979
1205
 
@@ -1011,52 +1237,36 @@ describe("sdk: Conditions", function () {
1011
1237
 
1012
1238
  // match
1013
1239
  expect(
1014
- allConditionsAreMatched(
1015
- conditions,
1016
- {
1017
- country: "nl",
1018
- browser_type: "chrome",
1019
- browser_version: "2.0",
1020
- },
1021
- logger,
1022
- ),
1240
+ datafileReader.allConditionsAreMatched(conditions, {
1241
+ country: "nl",
1242
+ browser_type: "chrome",
1243
+ browser_version: "2.0",
1244
+ }),
1023
1245
  ).toEqual(true);
1024
1246
 
1025
1247
  expect(
1026
- allConditionsAreMatched(
1027
- conditions,
1028
- {
1029
- country: "nl",
1030
- browser_type: "firefox",
1031
- device_type: "mobile",
1032
- orientation: "portrait",
1033
- },
1034
- logger,
1035
- ),
1248
+ datafileReader.allConditionsAreMatched(conditions, {
1249
+ country: "nl",
1250
+ browser_type: "firefox",
1251
+ device_type: "mobile",
1252
+ orientation: "portrait",
1253
+ }),
1036
1254
  ).toEqual(true);
1037
1255
 
1038
1256
  // not match
1039
1257
  expect(
1040
- allConditionsAreMatched(
1041
- conditions,
1042
- {
1043
- browser_type: "firefox",
1044
- browser_version: "2.0",
1045
- },
1046
- logger,
1047
- ),
1258
+ datafileReader.allConditionsAreMatched(conditions, {
1259
+ browser_type: "firefox",
1260
+ browser_version: "2.0",
1261
+ }),
1048
1262
  ).toEqual(false);
1049
1263
 
1050
1264
  expect(
1051
- allConditionsAreMatched(
1052
- conditions,
1053
- {
1054
- country: "de",
1055
- browser_type: "firefox",
1056
- device_type: "desktop",
1057
- },
1058
- logger,
1059
- ),
1265
+ datafileReader.allConditionsAreMatched(conditions, {
1266
+ country: "de",
1267
+ browser_type: "firefox",
1268
+ device_type: "desktop",
1269
+ }),
1060
1270
  ).toEqual(false);
1061
1271
  });
1062
1272
  });