@geekmidas/cache 0.0.4 → 0.0.5

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.
@@ -1,55 +1,54 @@
1
- const require_chunk = require('../chunk-CUT6urMc.cjs');
2
1
  const require_memory = require('../memory-n6Iosq6J.cjs');
3
- const require_upstash = require('../upstash-0RolGx7m.cjs');
4
- const vitest = require_chunk.__toESM(require("vitest"));
2
+ const require_upstash = require('../upstash-DiFDpOHy.cjs');
3
+ const require_vi_bdSIJ99Y = require('../vi.bdSIJ99Y-CKSnd2bq.cjs');
5
4
 
6
5
  //#region src/__tests__/cache.spec.ts
7
- (0, vitest.describe)("Cache Interface", () => {
8
- (0, vitest.describe)("interface compliance", () => {
9
- (0, vitest.it)("InMemoryCache should implement Cache interface", () => {
6
+ require_vi_bdSIJ99Y.describe("Cache Interface", () => {
7
+ require_vi_bdSIJ99Y.describe("interface compliance", () => {
8
+ require_vi_bdSIJ99Y.it("InMemoryCache should implement Cache interface", () => {
10
9
  const cache = new require_memory.InMemoryCache();
11
- (0, vitest.expect)(typeof cache.get).toBe("function");
12
- (0, vitest.expect)(typeof cache.set).toBe("function");
13
- (0, vitest.expect)(typeof cache.delete).toBe("function");
10
+ require_vi_bdSIJ99Y.globalExpect(typeof cache.get).toBe("function");
11
+ require_vi_bdSIJ99Y.globalExpect(typeof cache.set).toBe("function");
12
+ require_vi_bdSIJ99Y.globalExpect(typeof cache.delete).toBe("function");
14
13
  });
15
- (0, vitest.it)("UpstashCache should implement Cache interface", () => {
14
+ require_vi_bdSIJ99Y.it("UpstashCache should implement Cache interface", () => {
16
15
  const cache = new require_upstash.UpstashCache("http://localhost:8079", "example_token");
17
- (0, vitest.expect)(typeof cache.get).toBe("function");
18
- (0, vitest.expect)(typeof cache.set).toBe("function");
19
- (0, vitest.expect)(typeof cache.delete).toBe("function");
16
+ require_vi_bdSIJ99Y.globalExpect(typeof cache.get).toBe("function");
17
+ require_vi_bdSIJ99Y.globalExpect(typeof cache.set).toBe("function");
18
+ require_vi_bdSIJ99Y.globalExpect(typeof cache.delete).toBe("function");
20
19
  });
21
20
  });
22
- (0, vitest.describe)("method signatures", () => {
23
- (0, vitest.it)("should have correct get method signature", () => {
21
+ require_vi_bdSIJ99Y.describe("method signatures", () => {
22
+ require_vi_bdSIJ99Y.it("should have correct get method signature", () => {
24
23
  const cache = new require_memory.InMemoryCache();
25
24
  const getResult = cache.get("test");
26
- (0, vitest.expect)(getResult).toBeInstanceOf(Promise);
25
+ require_vi_bdSIJ99Y.globalExpect(getResult).toBeInstanceOf(Promise);
27
26
  });
28
- (0, vitest.it)("should have correct set method signature", () => {
27
+ require_vi_bdSIJ99Y.it("should have correct set method signature", () => {
29
28
  const cache = new require_memory.InMemoryCache();
30
29
  const setResult = cache.set("test", "value");
31
- (0, vitest.expect)(setResult).toBeInstanceOf(Promise);
30
+ require_vi_bdSIJ99Y.globalExpect(setResult).toBeInstanceOf(Promise);
32
31
  });
33
- (0, vitest.it)("should have correct delete method signature", () => {
32
+ require_vi_bdSIJ99Y.it("should have correct delete method signature", () => {
34
33
  const cache = new require_memory.InMemoryCache();
35
34
  const deleteResult = cache.delete("test");
36
- (0, vitest.expect)(deleteResult).toBeInstanceOf(Promise);
35
+ require_vi_bdSIJ99Y.globalExpect(deleteResult).toBeInstanceOf(Promise);
37
36
  });
38
37
  });
39
- (0, vitest.describe)("generic type support", () => {
40
- (0, vitest.it)("should support string types", async () => {
38
+ require_vi_bdSIJ99Y.describe("generic type support", () => {
39
+ require_vi_bdSIJ99Y.it("should support string types", async () => {
41
40
  const cache = new require_memory.InMemoryCache();
42
41
  await cache.set("key", "value");
43
42
  const result = await cache.get("key");
44
- (0, vitest.expect)(typeof result === "string" || result === void 0).toBe(true);
43
+ require_vi_bdSIJ99Y.globalExpect(typeof result === "string" || result === void 0).toBe(true);
45
44
  });
46
- (0, vitest.it)("should support number types", async () => {
45
+ require_vi_bdSIJ99Y.it("should support number types", async () => {
47
46
  const cache = new require_memory.InMemoryCache();
48
47
  await cache.set("key", 42);
49
48
  const result = await cache.get("key");
50
- (0, vitest.expect)(typeof result === "number" || result === void 0).toBe(true);
49
+ require_vi_bdSIJ99Y.globalExpect(typeof result === "number" || result === void 0).toBe(true);
51
50
  });
52
- (0, vitest.it)("should support object types", async () => {
51
+ require_vi_bdSIJ99Y.it("should support object types", async () => {
53
52
  const cache = new require_memory.InMemoryCache();
54
53
  const user = {
55
54
  id: 1,
@@ -57,9 +56,9 @@ const vitest = require_chunk.__toESM(require("vitest"));
57
56
  };
58
57
  await cache.set("user", user);
59
58
  const result = await cache.get("user");
60
- (0, vitest.expect)(result === void 0 || typeof result === "object" && "id" in result && "name" in result).toBe(true);
59
+ require_vi_bdSIJ99Y.globalExpect(result === void 0 || typeof result === "object" && "id" in result && "name" in result).toBe(true);
61
60
  });
62
- (0, vitest.it)("should support union types", async () => {
61
+ require_vi_bdSIJ99Y.it("should support union types", async () => {
63
62
  const cache = new require_memory.InMemoryCache();
64
63
  await cache.set("string", "text");
65
64
  await cache.set("number", 42);
@@ -67,9 +66,9 @@ const vitest = require_chunk.__toESM(require("vitest"));
67
66
  const stringResult = await cache.get("string");
68
67
  const numberResult = await cache.get("number");
69
68
  const booleanResult = await cache.get("boolean");
70
- (0, vitest.expect)(stringResult).toBe("text");
71
- (0, vitest.expect)(numberResult).toBe(42);
72
- (0, vitest.expect)(booleanResult).toBe(true);
69
+ require_vi_bdSIJ99Y.globalExpect(stringResult).toBe("text");
70
+ require_vi_bdSIJ99Y.globalExpect(numberResult).toBe(42);
71
+ require_vi_bdSIJ99Y.globalExpect(booleanResult).toBe(true);
73
72
  });
74
73
  });
75
74
  });
@@ -1,38 +1,38 @@
1
- import { InMemoryCache } from "../memory-NQi0XmZ2.mjs";
2
- import { UpstashCache } from "../upstash-CTY-M8vR.mjs";
3
- import { describe, expect, it } from "vitest";
1
+ import { describe, globalExpect, it } from "../vi.bdSIJ99Y-DffpE2Zw.mjs";
2
+ import { InMemoryCache } from "../memory-YteQXj7m.mjs";
3
+ import { UpstashCache } from "../upstash-_05vyc5o.mjs";
4
4
 
5
5
  //#region src/__tests__/cache.spec.ts
6
6
  describe("Cache Interface", () => {
7
7
  describe("interface compliance", () => {
8
8
  it("InMemoryCache should implement Cache interface", () => {
9
9
  const cache = new InMemoryCache();
10
- expect(typeof cache.get).toBe("function");
11
- expect(typeof cache.set).toBe("function");
12
- expect(typeof cache.delete).toBe("function");
10
+ globalExpect(typeof cache.get).toBe("function");
11
+ globalExpect(typeof cache.set).toBe("function");
12
+ globalExpect(typeof cache.delete).toBe("function");
13
13
  });
14
14
  it("UpstashCache should implement Cache interface", () => {
15
15
  const cache = new UpstashCache("http://localhost:8079", "example_token");
16
- expect(typeof cache.get).toBe("function");
17
- expect(typeof cache.set).toBe("function");
18
- expect(typeof cache.delete).toBe("function");
16
+ globalExpect(typeof cache.get).toBe("function");
17
+ globalExpect(typeof cache.set).toBe("function");
18
+ globalExpect(typeof cache.delete).toBe("function");
19
19
  });
20
20
  });
21
21
  describe("method signatures", () => {
22
22
  it("should have correct get method signature", () => {
23
23
  const cache = new InMemoryCache();
24
24
  const getResult = cache.get("test");
25
- expect(getResult).toBeInstanceOf(Promise);
25
+ globalExpect(getResult).toBeInstanceOf(Promise);
26
26
  });
27
27
  it("should have correct set method signature", () => {
28
28
  const cache = new InMemoryCache();
29
29
  const setResult = cache.set("test", "value");
30
- expect(setResult).toBeInstanceOf(Promise);
30
+ globalExpect(setResult).toBeInstanceOf(Promise);
31
31
  });
32
32
  it("should have correct delete method signature", () => {
33
33
  const cache = new InMemoryCache();
34
34
  const deleteResult = cache.delete("test");
35
- expect(deleteResult).toBeInstanceOf(Promise);
35
+ globalExpect(deleteResult).toBeInstanceOf(Promise);
36
36
  });
37
37
  });
38
38
  describe("generic type support", () => {
@@ -40,13 +40,13 @@ describe("Cache Interface", () => {
40
40
  const cache = new InMemoryCache();
41
41
  await cache.set("key", "value");
42
42
  const result = await cache.get("key");
43
- expect(typeof result === "string" || result === void 0).toBe(true);
43
+ globalExpect(typeof result === "string" || result === void 0).toBe(true);
44
44
  });
45
45
  it("should support number types", async () => {
46
46
  const cache = new InMemoryCache();
47
47
  await cache.set("key", 42);
48
48
  const result = await cache.get("key");
49
- expect(typeof result === "number" || result === void 0).toBe(true);
49
+ globalExpect(typeof result === "number" || result === void 0).toBe(true);
50
50
  });
51
51
  it("should support object types", async () => {
52
52
  const cache = new InMemoryCache();
@@ -56,7 +56,7 @@ describe("Cache Interface", () => {
56
56
  };
57
57
  await cache.set("user", user);
58
58
  const result = await cache.get("user");
59
- expect(result === void 0 || typeof result === "object" && "id" in result && "name" in result).toBe(true);
59
+ globalExpect(result === void 0 || typeof result === "object" && "id" in result && "name" in result).toBe(true);
60
60
  });
61
61
  it("should support union types", async () => {
62
62
  const cache = new InMemoryCache();
@@ -66,9 +66,9 @@ describe("Cache Interface", () => {
66
66
  const stringResult = await cache.get("string");
67
67
  const numberResult = await cache.get("number");
68
68
  const booleanResult = await cache.get("boolean");
69
- expect(stringResult).toBe("text");
70
- expect(numberResult).toBe(42);
71
- expect(booleanResult).toBe(true);
69
+ globalExpect(stringResult).toBe("text");
70
+ globalExpect(numberResult).toBe(42);
71
+ globalExpect(booleanResult).toBe(true);
72
72
  });
73
73
  });
74
74
  });
@@ -1,31 +1,30 @@
1
- const require_chunk = require('../chunk-CUT6urMc.cjs');
2
1
  const require_memory = require('../memory-n6Iosq6J.cjs');
3
- const vitest = require_chunk.__toESM(require("vitest"));
2
+ const require_vi_bdSIJ99Y = require('../vi.bdSIJ99Y-CKSnd2bq.cjs');
4
3
 
5
4
  //#region src/__tests__/integration.spec.ts
6
- (0, vitest.describe)("Cache Integration Tests", () => {
5
+ require_vi_bdSIJ99Y.describe("Cache Integration Tests", () => {
7
6
  let memoryCache;
8
- (0, vitest.beforeEach)(() => {
7
+ require_vi_bdSIJ99Y.beforeEach(() => {
9
8
  memoryCache = new require_memory.InMemoryCache();
10
9
  });
11
- (0, vitest.describe)("cross-cache behavior consistency", () => {
10
+ require_vi_bdSIJ99Y.describe("cross-cache behavior consistency", () => {
12
11
  const testCases = [{
13
12
  name: "InMemoryCache",
14
13
  cache: () => new require_memory.InMemoryCache()
15
14
  }];
16
15
  testCases.forEach(({ name, cache }) => {
17
- (0, vitest.describe)(name, () => {
16
+ require_vi_bdSIJ99Y.describe(name, () => {
18
17
  let cacheInstance;
19
- (0, vitest.beforeEach)(() => {
18
+ require_vi_bdSIJ99Y.beforeEach(() => {
20
19
  cacheInstance = cache();
21
20
  });
22
- (0, vitest.it)("should handle basic CRUD operations", async () => {
21
+ require_vi_bdSIJ99Y.it("should handle basic CRUD operations", async () => {
23
22
  await cacheInstance.set("user:1", {
24
23
  id: 1,
25
24
  name: "John"
26
25
  });
27
26
  const user = await cacheInstance.get("user:1");
28
- (0, vitest.expect)(user).toEqual({
27
+ require_vi_bdSIJ99Y.globalExpect(user).toEqual({
29
28
  id: 1,
30
29
  name: "John"
31
30
  });
@@ -34,15 +33,15 @@ const vitest = require_chunk.__toESM(require("vitest"));
34
33
  name: "Jane"
35
34
  });
36
35
  const updatedUser = await cacheInstance.get("user:1");
37
- (0, vitest.expect)(updatedUser).toEqual({
36
+ require_vi_bdSIJ99Y.globalExpect(updatedUser).toEqual({
38
37
  id: 1,
39
38
  name: "Jane"
40
39
  });
41
40
  await cacheInstance.delete("user:1");
42
41
  const deletedUser = await cacheInstance.get("user:1");
43
- (0, vitest.expect)(deletedUser).toBeUndefined();
42
+ require_vi_bdSIJ99Y.globalExpect(deletedUser).toBeUndefined();
44
43
  });
45
- (0, vitest.it)("should handle concurrent operations", async () => {
44
+ require_vi_bdSIJ99Y.it("should handle concurrent operations", async () => {
46
45
  const operations = [
47
46
  cacheInstance.set("key1", "value1"),
48
47
  cacheInstance.set("key2", "value2"),
@@ -54,13 +53,13 @@ const vitest = require_chunk.__toESM(require("vitest"));
54
53
  cacheInstance.get("key2"),
55
54
  cacheInstance.get("key3")
56
55
  ]);
57
- (0, vitest.expect)(results).toEqual([
56
+ require_vi_bdSIJ99Y.globalExpect(results).toEqual([
58
57
  "value1",
59
58
  "value2",
60
59
  "value3"
61
60
  ]);
62
61
  });
63
- (0, vitest.it)("should handle data type preservation", async () => {
62
+ require_vi_bdSIJ99Y.it("should handle data type preservation", async () => {
64
63
  const testData = {
65
64
  string: "hello",
66
65
  number: 42,
@@ -75,31 +74,31 @@ const vitest = require_chunk.__toESM(require("vitest"));
75
74
  };
76
75
  await Promise.all(Object.entries(testData).map(([key, value]) => cacheInstance.set(key, value)));
77
76
  const results = await Promise.all(Object.keys(testData).map((key) => cacheInstance.get(key)));
78
- (0, vitest.expect)(results[0]).toBe("hello");
79
- (0, vitest.expect)(results[1]).toBe(42);
80
- (0, vitest.expect)(results[2]).toBe(true);
81
- (0, vitest.expect)(results[3]).toEqual({ nested: true });
82
- (0, vitest.expect)(results[4]).toEqual([
77
+ require_vi_bdSIJ99Y.globalExpect(results[0]).toBe("hello");
78
+ require_vi_bdSIJ99Y.globalExpect(results[1]).toBe(42);
79
+ require_vi_bdSIJ99Y.globalExpect(results[2]).toBe(true);
80
+ require_vi_bdSIJ99Y.globalExpect(results[3]).toEqual({ nested: true });
81
+ require_vi_bdSIJ99Y.globalExpect(results[4]).toEqual([
83
82
  1,
84
83
  2,
85
84
  3
86
85
  ]);
87
- (0, vitest.expect)(results[5]).toBeNull();
86
+ require_vi_bdSIJ99Y.globalExpect(results[5]).toBeNull();
88
87
  });
89
- (0, vitest.it)("should handle key isolation", async () => {
88
+ require_vi_bdSIJ99Y.it("should handle key isolation", async () => {
90
89
  await cacheInstance.set("user:1", "User One");
91
90
  await cacheInstance.set("user:2", "User Two");
92
91
  await cacheInstance.set("session:1", "Session One");
93
92
  await cacheInstance.delete("user:1");
94
- (0, vitest.expect)(await cacheInstance.get("user:1")).toBeUndefined();
95
- (0, vitest.expect)(await cacheInstance.get("user:2")).toBe("User Two");
96
- (0, vitest.expect)(await cacheInstance.get("session:1")).toBe("Session One");
93
+ require_vi_bdSIJ99Y.globalExpect(await cacheInstance.get("user:1")).toBeUndefined();
94
+ require_vi_bdSIJ99Y.globalExpect(await cacheInstance.get("user:2")).toBe("User Two");
95
+ require_vi_bdSIJ99Y.globalExpect(await cacheInstance.get("session:1")).toBe("Session One");
97
96
  });
98
97
  });
99
98
  });
100
99
  });
101
- (0, vitest.describe)("cache migration scenarios", () => {
102
- (0, vitest.it)("should support migrating data between cache implementations", async () => {
100
+ require_vi_bdSIJ99Y.describe("cache migration scenarios", () => {
101
+ require_vi_bdSIJ99Y.it("should support migrating data between cache implementations", async () => {
103
102
  const sourceCache = new require_memory.InMemoryCache();
104
103
  const targetCache = new require_memory.InMemoryCache();
105
104
  const testData = {
@@ -124,12 +123,12 @@ const vitest = require_chunk.__toESM(require("vitest"));
124
123
  }
125
124
  for (const [key, expectedValue] of Object.entries(testData)) {
126
125
  const migratedValue = await targetCache.get(key);
127
- (0, vitest.expect)(migratedValue).toEqual(expectedValue);
126
+ require_vi_bdSIJ99Y.globalExpect(migratedValue).toEqual(expectedValue);
128
127
  }
129
128
  });
130
129
  });
131
- (0, vitest.describe)("cache abstraction patterns", () => {
132
- (0, vitest.it)("should support cache factory pattern", async () => {
130
+ require_vi_bdSIJ99Y.describe("cache abstraction patterns", () => {
131
+ require_vi_bdSIJ99Y.it("should support cache factory pattern", async () => {
133
132
  const createCache = (type) => {
134
133
  switch (type) {
135
134
  case "memory": return new require_memory.InMemoryCache();
@@ -143,13 +142,13 @@ const vitest = require_chunk.__toESM(require("vitest"));
143
142
  name: "John"
144
143
  });
145
144
  await sessionCache.set("session:abc", "active");
146
- (0, vitest.expect)(await userCache.get("user:1")).toEqual({
145
+ require_vi_bdSIJ99Y.globalExpect(await userCache.get("user:1")).toEqual({
147
146
  id: 1,
148
147
  name: "John"
149
148
  });
150
- (0, vitest.expect)(await sessionCache.get("session:abc")).toBe("active");
149
+ require_vi_bdSIJ99Y.globalExpect(await sessionCache.get("session:abc")).toBe("active");
151
150
  });
152
- (0, vitest.it)("should support cache wrapper pattern", async () => {
151
+ require_vi_bdSIJ99Y.it("should support cache wrapper pattern", async () => {
153
152
  class LoggingCache {
154
153
  logs = [];
155
154
  constructor(underlying) {
@@ -177,28 +176,28 @@ const vitest = require_chunk.__toESM(require("vitest"));
177
176
  await loggingCache.get("test");
178
177
  await loggingCache.delete("test");
179
178
  const logs = loggingCache.getLogs();
180
- (0, vitest.expect)(logs).toEqual([
179
+ require_vi_bdSIJ99Y.globalExpect(logs).toEqual([
181
180
  "SET test",
182
181
  "GET test",
183
182
  "DELETE test"
184
183
  ]);
185
184
  });
186
185
  });
187
- (0, vitest.describe)("performance and stress tests", () => {
188
- (0, vitest.it)("should handle large number of operations", async () => {
186
+ require_vi_bdSIJ99Y.describe("performance and stress tests", () => {
187
+ require_vi_bdSIJ99Y.it("should handle large number of operations", async () => {
189
188
  const cache = new require_memory.InMemoryCache();
190
189
  const operationCount = 1e3;
191
190
  const insertPromises = Array.from({ length: operationCount }, (_, i) => cache.set(`key:${i}`, i));
192
191
  await Promise.all(insertPromises);
193
192
  const readPromises = Array.from({ length: operationCount }, (_, i) => cache.get(`key:${i}`));
194
193
  const results = await Promise.all(readPromises);
195
- for (let i = 0; i < operationCount; i++) (0, vitest.expect)(results[i]).toBe(i);
194
+ for (let i = 0; i < operationCount; i++) require_vi_bdSIJ99Y.globalExpect(results[i]).toBe(i);
196
195
  const deletePromises = Array.from({ length: operationCount }, (_, i) => cache.delete(`key:${i}`));
197
196
  await Promise.all(deletePromises);
198
197
  const postDeleteRead = await cache.get("key:0");
199
- (0, vitest.expect)(postDeleteRead).toBeUndefined();
198
+ require_vi_bdSIJ99Y.globalExpect(postDeleteRead).toBeUndefined();
200
199
  });
201
- (0, vitest.it)("should handle large objects efficiently", async () => {
200
+ require_vi_bdSIJ99Y.it("should handle large objects efficiently", async () => {
202
201
  const cache = new require_memory.InMemoryCache();
203
202
  const largeObject = {
204
203
  id: 1,
@@ -215,19 +214,19 @@ const vitest = require_chunk.__toESM(require("vitest"));
215
214
  await cache.set("large-object", largeObject);
216
215
  const result = await cache.get("large-object");
217
216
  const endTime = Date.now();
218
- (0, vitest.expect)(result).toEqual(largeObject);
219
- (0, vitest.expect)(endTime - startTime).toBeLessThan(100);
217
+ require_vi_bdSIJ99Y.globalExpect(result).toEqual(largeObject);
218
+ require_vi_bdSIJ99Y.globalExpect(endTime - startTime).toBeLessThan(100);
220
219
  });
221
220
  });
222
- (0, vitest.describe)("error scenarios", () => {
223
- (0, vitest.it)("should handle operations after errors gracefully", async () => {
221
+ require_vi_bdSIJ99Y.describe("error scenarios", () => {
222
+ require_vi_bdSIJ99Y.it("should handle operations after errors gracefully", async () => {
224
223
  const cache = new require_memory.InMemoryCache();
225
224
  await cache.set("valid-key", "valid-value");
226
- (0, vitest.expect)(await cache.get("valid-key")).toBe("valid-value");
225
+ require_vi_bdSIJ99Y.globalExpect(await cache.get("valid-key")).toBe("valid-value");
227
226
  await cache.set("another-key", "another-value");
228
- (0, vitest.expect)(await cache.get("another-key")).toBe("another-value");
227
+ require_vi_bdSIJ99Y.globalExpect(await cache.get("another-key")).toBe("another-value");
229
228
  await cache.delete("valid-key");
230
- (0, vitest.expect)(await cache.get("valid-key")).toBeUndefined();
229
+ require_vi_bdSIJ99Y.globalExpect(await cache.get("valid-key")).toBeUndefined();
231
230
  });
232
231
  });
233
232
  });
@@ -1,5 +1,5 @@
1
- import { InMemoryCache } from "../memory-NQi0XmZ2.mjs";
2
- import { beforeEach, describe, expect, it } from "vitest";
1
+ import { beforeEach, describe, globalExpect, it } from "../vi.bdSIJ99Y-DffpE2Zw.mjs";
2
+ import { InMemoryCache } from "../memory-YteQXj7m.mjs";
3
3
 
4
4
  //#region src/__tests__/integration.spec.ts
5
5
  describe("Cache Integration Tests", () => {
@@ -24,7 +24,7 @@ describe("Cache Integration Tests", () => {
24
24
  name: "John"
25
25
  });
26
26
  const user = await cacheInstance.get("user:1");
27
- expect(user).toEqual({
27
+ globalExpect(user).toEqual({
28
28
  id: 1,
29
29
  name: "John"
30
30
  });
@@ -33,13 +33,13 @@ describe("Cache Integration Tests", () => {
33
33
  name: "Jane"
34
34
  });
35
35
  const updatedUser = await cacheInstance.get("user:1");
36
- expect(updatedUser).toEqual({
36
+ globalExpect(updatedUser).toEqual({
37
37
  id: 1,
38
38
  name: "Jane"
39
39
  });
40
40
  await cacheInstance.delete("user:1");
41
41
  const deletedUser = await cacheInstance.get("user:1");
42
- expect(deletedUser).toBeUndefined();
42
+ globalExpect(deletedUser).toBeUndefined();
43
43
  });
44
44
  it("should handle concurrent operations", async () => {
45
45
  const operations = [
@@ -53,7 +53,7 @@ describe("Cache Integration Tests", () => {
53
53
  cacheInstance.get("key2"),
54
54
  cacheInstance.get("key3")
55
55
  ]);
56
- expect(results).toEqual([
56
+ globalExpect(results).toEqual([
57
57
  "value1",
58
58
  "value2",
59
59
  "value3"
@@ -74,25 +74,25 @@ describe("Cache Integration Tests", () => {
74
74
  };
75
75
  await Promise.all(Object.entries(testData).map(([key, value]) => cacheInstance.set(key, value)));
76
76
  const results = await Promise.all(Object.keys(testData).map((key) => cacheInstance.get(key)));
77
- expect(results[0]).toBe("hello");
78
- expect(results[1]).toBe(42);
79
- expect(results[2]).toBe(true);
80
- expect(results[3]).toEqual({ nested: true });
81
- expect(results[4]).toEqual([
77
+ globalExpect(results[0]).toBe("hello");
78
+ globalExpect(results[1]).toBe(42);
79
+ globalExpect(results[2]).toBe(true);
80
+ globalExpect(results[3]).toEqual({ nested: true });
81
+ globalExpect(results[4]).toEqual([
82
82
  1,
83
83
  2,
84
84
  3
85
85
  ]);
86
- expect(results[5]).toBeNull();
86
+ globalExpect(results[5]).toBeNull();
87
87
  });
88
88
  it("should handle key isolation", async () => {
89
89
  await cacheInstance.set("user:1", "User One");
90
90
  await cacheInstance.set("user:2", "User Two");
91
91
  await cacheInstance.set("session:1", "Session One");
92
92
  await cacheInstance.delete("user:1");
93
- expect(await cacheInstance.get("user:1")).toBeUndefined();
94
- expect(await cacheInstance.get("user:2")).toBe("User Two");
95
- expect(await cacheInstance.get("session:1")).toBe("Session One");
93
+ globalExpect(await cacheInstance.get("user:1")).toBeUndefined();
94
+ globalExpect(await cacheInstance.get("user:2")).toBe("User Two");
95
+ globalExpect(await cacheInstance.get("session:1")).toBe("Session One");
96
96
  });
97
97
  });
98
98
  });
@@ -123,7 +123,7 @@ describe("Cache Integration Tests", () => {
123
123
  }
124
124
  for (const [key, expectedValue] of Object.entries(testData)) {
125
125
  const migratedValue = await targetCache.get(key);
126
- expect(migratedValue).toEqual(expectedValue);
126
+ globalExpect(migratedValue).toEqual(expectedValue);
127
127
  }
128
128
  });
129
129
  });
@@ -142,11 +142,11 @@ describe("Cache Integration Tests", () => {
142
142
  name: "John"
143
143
  });
144
144
  await sessionCache.set("session:abc", "active");
145
- expect(await userCache.get("user:1")).toEqual({
145
+ globalExpect(await userCache.get("user:1")).toEqual({
146
146
  id: 1,
147
147
  name: "John"
148
148
  });
149
- expect(await sessionCache.get("session:abc")).toBe("active");
149
+ globalExpect(await sessionCache.get("session:abc")).toBe("active");
150
150
  });
151
151
  it("should support cache wrapper pattern", async () => {
152
152
  class LoggingCache {
@@ -176,7 +176,7 @@ describe("Cache Integration Tests", () => {
176
176
  await loggingCache.get("test");
177
177
  await loggingCache.delete("test");
178
178
  const logs = loggingCache.getLogs();
179
- expect(logs).toEqual([
179
+ globalExpect(logs).toEqual([
180
180
  "SET test",
181
181
  "GET test",
182
182
  "DELETE test"
@@ -191,11 +191,11 @@ describe("Cache Integration Tests", () => {
191
191
  await Promise.all(insertPromises);
192
192
  const readPromises = Array.from({ length: operationCount }, (_, i) => cache.get(`key:${i}`));
193
193
  const results = await Promise.all(readPromises);
194
- for (let i = 0; i < operationCount; i++) expect(results[i]).toBe(i);
194
+ for (let i = 0; i < operationCount; i++) globalExpect(results[i]).toBe(i);
195
195
  const deletePromises = Array.from({ length: operationCount }, (_, i) => cache.delete(`key:${i}`));
196
196
  await Promise.all(deletePromises);
197
197
  const postDeleteRead = await cache.get("key:0");
198
- expect(postDeleteRead).toBeUndefined();
198
+ globalExpect(postDeleteRead).toBeUndefined();
199
199
  });
200
200
  it("should handle large objects efficiently", async () => {
201
201
  const cache = new InMemoryCache();
@@ -214,19 +214,19 @@ describe("Cache Integration Tests", () => {
214
214
  await cache.set("large-object", largeObject);
215
215
  const result = await cache.get("large-object");
216
216
  const endTime = Date.now();
217
- expect(result).toEqual(largeObject);
218
- expect(endTime - startTime).toBeLessThan(100);
217
+ globalExpect(result).toEqual(largeObject);
218
+ globalExpect(endTime - startTime).toBeLessThan(100);
219
219
  });
220
220
  });
221
221
  describe("error scenarios", () => {
222
222
  it("should handle operations after errors gracefully", async () => {
223
223
  const cache = new InMemoryCache();
224
224
  await cache.set("valid-key", "valid-value");
225
- expect(await cache.get("valid-key")).toBe("valid-value");
225
+ globalExpect(await cache.get("valid-key")).toBe("valid-value");
226
226
  await cache.set("another-key", "another-value");
227
- expect(await cache.get("another-key")).toBe("another-value");
227
+ globalExpect(await cache.get("another-key")).toBe("another-value");
228
228
  await cache.delete("valid-key");
229
- expect(await cache.get("valid-key")).toBeUndefined();
229
+ globalExpect(await cache.get("valid-key")).toBeUndefined();
230
230
  });
231
231
  });
232
232
  });