aws-sdk-vitest-mock 0.4.0 → 0.5.0

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.
package/index.js CHANGED
@@ -1,347 +1,454 @@
1
- import { vi as b } from "vitest";
2
- import { readFileSync as R } from "node:fs";
3
- import N from "node:path";
4
- import { Readable as W } from "node:stream";
5
- import { m as Y } from "./matchers-C6AtmwWz.js";
6
- class d extends Error {
7
- constructor(e, s, c, n) {
8
- super(e), this.name = "AwsError", this.code = s, this.statusCode = c, this.retryable = n;
1
+ import { vi as v } from "vitest";
2
+ import { c as y } from "./matchers-ClGOsQx8.js";
3
+ import { m as ne } from "./matchers-ClGOsQx8.js";
4
+ import { readFileSync as P } from "node:fs";
5
+ import F from "node:path";
6
+ import { Readable as O } from "node:stream";
7
+ class f extends Error {
8
+ constructor(t, n, i, o) {
9
+ super(t), this.name = "AwsError", this.code = n, this.statusCode = i, this.retryable = o;
9
10
  }
10
11
  }
11
- const C = (t) => {
12
- const e = t ? `The specified key does not exist. Key: ${t}` : "The specified key does not exist.";
13
- return new d(e, "NoSuchKey", 404, !1);
14
- }, $ = (t) => {
15
- const e = t ? `The specified bucket does not exist. Bucket: ${t}` : "The specified bucket does not exist.";
16
- return new d(e, "NoSuchBucket", 404, !1);
17
- }, D = (t) => {
18
- const e = t ? `Access Denied for resource: ${t}` : "Access Denied";
19
- return new d(e, "AccessDenied", 403, !1);
20
- }, M = (t) => {
21
- const e = t ? `Requested resource not found: ${t}` : "Requested resource not found";
22
- return new d(e, "ResourceNotFoundException", 400, !1);
23
- }, T = () => new d(
12
+ const L = (e) => {
13
+ const t = e ? `The specified key does not exist. Key: ${e}` : "The specified key does not exist.";
14
+ return new f(t, "NoSuchKey", 404, !1);
15
+ }, D = (e) => {
16
+ const t = e ? `The specified bucket does not exist. Bucket: ${e}` : "The specified bucket does not exist.";
17
+ return new f(t, "NoSuchBucket", 404, !1);
18
+ }, I = (e) => {
19
+ const t = e ? `Access Denied for resource: ${e}` : "Access Denied";
20
+ return new f(t, "AccessDenied", 403, !1);
21
+ }, T = (e) => {
22
+ const t = e ? `Requested resource not found: ${e}` : "Requested resource not found";
23
+ return new f(t, "ResourceNotFoundException", 400, !1);
24
+ }, K = () => new f(
24
25
  "The conditional request failed",
25
26
  "ConditionalCheckFailedException",
26
27
  400,
27
28
  !1
28
- ), I = () => new d("Rate exceeded", "Throttling", 400, !0), O = () => new d(
29
+ ), M = () => new f("Rate exceeded", "Throttling", 400, !0), A = () => new f(
29
30
  "We encountered an internal error. Please try again.",
30
31
  "InternalServerError",
31
32
  500,
32
33
  !0
33
34
  );
34
- function k() {
35
+ function B(e) {
36
+ try {
37
+ return JSON.stringify(e, void 0, 2);
38
+ } catch {
39
+ return typeof e == "object" && e !== null ? "[Complex Object]" : typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : "[Non-serializable value]";
40
+ }
41
+ }
42
+ function j() {
35
43
  return {
36
44
  enabled: !1,
37
- log(t, e) {
38
- this.enabled && (e === void 0 ? console.log(`[aws-sdk-vitest-mock](Debug) ${t}`) : console.log(`[aws-sdk-vitest-mock](Debug) ${t}`, e));
45
+ log(e, t) {
46
+ if (this.enabled)
47
+ if (t === void 0)
48
+ console.log(
49
+ `${y.magenta("aws-sdk-vitest-mock(debug):")} ${e}`
50
+ );
51
+ else {
52
+ const n = B(t);
53
+ console.log(
54
+ `${y.magenta("aws-sdk-vitest-mock(debug):")} ${e}
55
+ ${n}`
56
+ );
57
+ }
39
58
  }
40
59
  };
41
60
  }
42
- function y(t) {
43
- t.enabled = !0;
61
+ function S(e) {
62
+ e.enabled = !0;
44
63
  }
45
- function w(t) {
46
- t.enabled = !1;
64
+ function w(e) {
65
+ e.enabled = !1;
47
66
  }
48
- function F(t) {
49
- const e = N.resolve(t), s = R(e, "utf8");
50
- return t.endsWith(".json") ? JSON.parse(s) : s;
67
+ function J(e) {
68
+ const t = F.resolve(e), n = P(t, "utf8");
69
+ return e.endsWith(".json") ? JSON.parse(n) : n;
51
70
  }
52
- function L(t, e = {}) {
53
- const { pageSize: s = 10, tokenKey: c = "NextToken", itemsKey: n = "Items" } = e;
54
- if (t.length === 0)
55
- return [{ [n]: [] }];
56
- const o = [];
57
- for (let r = 0; r < t.length; r += s) {
58
- const u = t.slice(r, r + s), i = r + s < t.length, l = { [n]: u };
59
- if (i) {
60
- const a = l;
61
- a[c] = `token-${r + s}`;
71
+ function _(e, t = {}) {
72
+ const { pageSize: n = 10, tokenKey: i = "NextToken", itemsKey: o = "Items" } = t;
73
+ if (e.length === 0)
74
+ return [{ [o]: [] }];
75
+ const s = [];
76
+ for (let r = 0; r < e.length; r += n) {
77
+ const c = e.slice(r, r + n), l = r + n < e.length, u = { [o]: c };
78
+ if (l) {
79
+ const g = u, a = c[c.length - 1];
80
+ g[i] = a;
62
81
  }
63
- o.push(l);
82
+ s.push(u);
64
83
  }
65
- return o;
84
+ return s;
66
85
  }
67
- function K() {
86
+ function q() {
68
87
  return typeof process < "u" && process.versions?.node ? "node" : typeof process < "u" && process.versions?.bun ? "bun" : "browser";
69
88
  }
70
- function A(t) {
71
- const e = typeof t == "string" ? Buffer.from(t, "utf8") : Buffer.from(t);
72
- let s = !1;
73
- return new W({
89
+ function z(e) {
90
+ const t = typeof e == "string" ? Buffer.from(e, "utf8") : Buffer.from(e);
91
+ let n = !1;
92
+ return new O({
74
93
  read() {
75
- s || (this.push(e), this.push(null), s = !0);
94
+ n || (this.push(t), this.push(null), n = !0);
76
95
  }
77
96
  });
78
97
  }
79
- function B(t) {
80
- let e;
81
- return typeof t == "string" ? e = new TextEncoder().encode(t) : t instanceof Buffer ? e = new Uint8Array(t) : e = t, new ReadableStream({
82
- start(s) {
83
- s.enqueue(e), s.close();
98
+ function V(e) {
99
+ let t;
100
+ return typeof e == "string" ? t = new TextEncoder().encode(e) : e instanceof Buffer ? t = new Uint8Array(e) : t = e, new ReadableStream({
101
+ start(n) {
102
+ n.enqueue(t), n.close();
84
103
  }
85
104
  });
86
105
  }
87
- function h(t) {
88
- const e = K();
89
- return e === "node" || e === "bun" ? A(t) : B(t);
106
+ function k(e) {
107
+ const t = q();
108
+ return t === "node" || t === "bun" ? z(e) : V(e);
90
109
  }
91
- function v(t, e) {
92
- return Object.keys(e).every((s) => {
93
- const c = e[s], n = t[s];
94
- return c && typeof c == "object" && !Array.isArray(c) ? typeof n != "object" || n === null ? !1 : v(
95
- n,
96
- c
97
- ) : n === c;
110
+ function $(e, t) {
111
+ return Object.keys(t).every((n) => {
112
+ const i = t[n], o = e[n];
113
+ return i && typeof i == "object" && !Array.isArray(i) ? typeof o != "object" || o === null ? !1 : $(
114
+ o,
115
+ i
116
+ ) : o === i;
98
117
  });
99
118
  }
100
- function j(t, e) {
101
- if (t === e) return !0;
102
- if (typeof t != "object" || t === null || typeof e != "object" || e === null)
103
- return t === e;
104
- const s = Object.keys(t), c = Object.keys(e);
105
- return s.length !== c.length ? !1 : c.every((n) => {
106
- if (!Object.prototype.hasOwnProperty.call(t, n)) return !1;
107
- const o = t, r = e, u = o[n], i = r[n];
108
- return typeof u == "object" && u !== null && typeof i == "object" && i !== null ? j(u, i) : u === i;
119
+ function N(e, t) {
120
+ if (e === t) return !0;
121
+ if (typeof e != "object" || e === null || typeof t != "object" || t === null)
122
+ return e === t;
123
+ const n = Object.keys(e), i = Object.keys(t);
124
+ return n.length !== i.length ? !1 : i.every((o) => {
125
+ if (!Object.prototype.hasOwnProperty.call(e, o)) return !1;
126
+ const s = e, r = t, c = s[o], l = r[o];
127
+ return typeof c == "object" && c !== null && typeof l == "object" && l !== null ? N(c, l) : c === l;
109
128
  });
110
129
  }
111
- function x(t) {
112
- return async function(e) {
113
- const s = () => this;
114
- t.debugLogger.log(
115
- `Received command: ${e.constructor.name}`,
116
- e.input
130
+ function C(e) {
131
+ return async function(t) {
132
+ const n = () => this;
133
+ e.debugLogger.log(
134
+ `Received command: ${t.constructor.name}`,
135
+ t.input
117
136
  );
118
- const c = t.map.get(
119
- e.constructor
137
+ const i = e.map.get(
138
+ t.constructor
120
139
  );
121
- if (c) {
122
- t.debugLogger.log(
123
- `Found ${c.length} mock(s) for ${e.constructor.name}`
140
+ if (i) {
141
+ e.debugLogger.log(
142
+ `Found ${i.length} mock(s) for ${t.constructor.name}`
124
143
  );
125
- const n = c.findIndex((o) => o.strict ? o.matcher && j(e.input, o.matcher) : !o.matcher || v(e.input, o.matcher));
126
- if (n === -1)
127
- t.debugLogger.log(
128
- `No matching mock found for ${e.constructor.name}`,
129
- e.input
144
+ const s = i.findIndex((r) => r.strict ? r.matcher && N(t.input, r.matcher) : !r.matcher || $(t.input, r.matcher));
145
+ if (s === -1) {
146
+ e.debugLogger.log(
147
+ `No matching mock found for ${t.constructor.name}`,
148
+ t.input
149
+ );
150
+ const r = i.map((l, u) => {
151
+ const g = l.matcher ? JSON.stringify(l.matcher, void 0, 2) : "any input", a = l.strict ? " (strict mode)" : "";
152
+ return ` Mock #${u + 1}: ${g}${a}`;
153
+ }).join(`
154
+ `), c = JSON.stringify(t.input, void 0, 2);
155
+ throw new Error(
156
+ `No matching mock found for ${t.constructor.name}.
157
+
158
+ Found ${i.length} mock(s) but none matched the input.
159
+
160
+ Configured mocks:
161
+ ${r}
162
+
163
+ Received input:
164
+ ${c}
165
+
166
+ Tip: Enable debug mode with enableDebug() for detailed matching information.`
130
167
  );
131
- else {
132
- const o = c[n];
133
- if (!o)
134
- throw new Error(`Mock at index ${n} not found`);
135
- return t.debugLogger.log(
136
- `Using mock at index ${n} for ${e.constructor.name}`
137
- ), o.once && (c.splice(n, 1), t.debugLogger.log(
138
- `Removed one-time mock for ${e.constructor.name}`
139
- )), o.handler(
140
- e.input,
141
- s()
168
+ } else {
169
+ const r = i[s];
170
+ if (!r)
171
+ throw new Error(`Mock at index ${s} not found`);
172
+ return e.debugLogger.log(
173
+ `Using mock at index ${s} for ${t.constructor.name}`
174
+ ), r.once && (i.splice(s, 1), e.debugLogger.log(
175
+ `Removed one-time mock for ${t.constructor.name}`
176
+ )), r.handler(
177
+ t.input,
178
+ n()
142
179
  );
143
180
  }
144
181
  } else
145
- t.debugLogger.log(
146
- `No mocks configured for ${e.constructor.name}`
182
+ e.debugLogger.log(
183
+ `No mocks configured for ${t.constructor.name}`
147
184
  );
185
+ const o = JSON.stringify(t.input, void 0, 2);
148
186
  throw new Error(
149
- `No mock configured for command: ${e.constructor.name}`
187
+ `No mock configured for command: ${t.constructor.name}.
188
+
189
+ Received input:
190
+ ${o}
191
+
192
+ Did you forget to call mockClient.on(${t.constructor.name})?`
150
193
  );
151
194
  };
152
195
  }
153
- function S(t, e, s, c = {}) {
154
- const n = (r, u) => {
155
- const i = {
156
- matcher: s,
196
+ function R(e, t, n, i = {}) {
197
+ const o = (r, c, l) => {
198
+ const u = {
199
+ matcher: n,
157
200
  handler: r,
158
- once: u,
159
- strict: !!c.strict
160
- }, l = t.map.get(e) ?? [];
161
- if (u) {
162
- const a = l.findIndex((f) => !f.once);
163
- a === -1 ? l.push(i) : l.splice(a, 0, i), t.map.set(
164
- e,
165
- l
201
+ once: c,
202
+ strict: !!i.strict
203
+ }, g = e.map.get(t) ?? [];
204
+ if (c) {
205
+ const a = g.findIndex((d) => !d.once);
206
+ a === -1 ? g.push(u) : g.splice(a, 0, u), e.map.set(
207
+ t,
208
+ g
209
+ ), e.debugLogger.log(
210
+ `Configured ${l}Once for ${t.name}`,
211
+ n ? { matcher: n, strict: !!i.strict } : void 0
166
212
  );
167
213
  } else {
168
- const a = l.filter(
169
- (f) => f.once || JSON.stringify(f.matcher) !== JSON.stringify(s)
214
+ const a = g.filter(
215
+ (d) => d.once || JSON.stringify(d.matcher) !== JSON.stringify(n)
170
216
  );
171
- a.push(i), t.map.set(
172
- e,
217
+ a.push(u), e.map.set(
218
+ t,
173
219
  a
220
+ ), e.debugLogger.log(
221
+ `Configured ${l} for ${t.name}`,
222
+ n ? { matcher: n, strict: !!i.strict } : void 0
174
223
  );
175
224
  }
176
- }, o = {
225
+ }, s = {
177
226
  resolves(r) {
178
- return n(() => Promise.resolve(r), !1), o;
227
+ return o(() => Promise.resolve(r), !1, "resolves"), s;
179
228
  },
180
229
  rejects(r) {
181
- return n(() => {
182
- const u = typeof r == "string" ? new Error(r) : r;
183
- return Promise.reject(u);
184
- }, !1), o;
230
+ return o(
231
+ () => {
232
+ const c = typeof r == "string" ? new Error(r) : r;
233
+ return Promise.reject(c);
234
+ },
235
+ !1,
236
+ "rejects"
237
+ ), s;
185
238
  },
186
239
  callsFake(r) {
187
- return n(r, !1), o;
240
+ return o(r, !1, "callsFake"), s;
188
241
  },
189
242
  resolvesOnce(r) {
190
- return n(() => Promise.resolve(r), !0), o;
243
+ return o(() => Promise.resolve(r), !0, "resolves"), s;
191
244
  },
192
245
  rejectsOnce(r) {
193
- return n(() => {
194
- const u = typeof r == "string" ? new Error(r) : r;
195
- return Promise.reject(u);
196
- }, !0), o;
246
+ return o(
247
+ () => {
248
+ const c = typeof r == "string" ? new Error(r) : r;
249
+ return Promise.reject(c);
250
+ },
251
+ !0,
252
+ "rejects"
253
+ ), s;
197
254
  },
198
255
  callsFakeOnce(r) {
199
- return n(r, !0), o;
256
+ return o(r, !0, "callsFake"), s;
200
257
  },
201
258
  resolvesStream(r) {
202
- return n(
203
- () => Promise.resolve({ Body: h(r) }),
204
- !1
205
- ), o;
259
+ return o(
260
+ () => Promise.resolve({ Body: k(r) }),
261
+ !1,
262
+ "resolvesStream"
263
+ ), s;
206
264
  },
207
265
  resolvesStreamOnce(r) {
208
- return n(
209
- () => Promise.resolve({ Body: h(r) }),
210
- !0
211
- ), o;
266
+ return o(
267
+ () => Promise.resolve({ Body: k(r) }),
268
+ !0,
269
+ "resolvesStream"
270
+ ), s;
212
271
  },
213
- resolvesWithDelay(r, u) {
214
- const i = (l) => {
215
- setTimeout(() => l(r), u);
272
+ resolvesWithDelay(r, c) {
273
+ const l = (u) => {
274
+ setTimeout(() => u(r), c);
216
275
  };
217
- return n(() => new Promise(i), !1), o;
276
+ return o(() => new Promise(l), !1, "resolvesWithDelay"), s;
218
277
  },
219
- rejectsWithDelay(r, u) {
220
- const i = typeof r == "string" ? new Error(r) : r, l = (a, f) => {
221
- setTimeout(() => f(i), u);
278
+ rejectsWithDelay(r, c) {
279
+ const l = typeof r == "string" ? new Error(r) : r, u = (g, a) => {
280
+ setTimeout(() => a(l), c);
222
281
  };
223
- return n(() => new Promise(l), !1), o;
282
+ return o(() => new Promise(u), !1, "rejectsWithDelay"), s;
224
283
  },
225
284
  rejectsWithNoSuchKey(r) {
226
- return n(() => Promise.reject(C(r)), !1), o;
285
+ return o(
286
+ () => Promise.reject(L(r)),
287
+ !1,
288
+ "rejectsWithNoSuchKey"
289
+ ), s;
227
290
  },
228
291
  rejectsWithNoSuchBucket(r) {
229
- return n(() => Promise.reject($(r)), !1), o;
292
+ return o(
293
+ () => Promise.reject(D(r)),
294
+ !1,
295
+ "rejectsWithNoSuchBucket"
296
+ ), s;
230
297
  },
231
298
  rejectsWithAccessDenied(r) {
232
- return n(() => Promise.reject(D(r)), !1), o;
299
+ return o(
300
+ () => Promise.reject(I(r)),
301
+ !1,
302
+ "rejectsWithAccessDenied"
303
+ ), s;
233
304
  },
234
305
  rejectsWithResourceNotFound(r) {
235
- return n(
236
- () => Promise.reject(M(r)),
237
- !1
238
- ), o;
306
+ return o(
307
+ () => Promise.reject(T(r)),
308
+ !1,
309
+ "rejectsWithResourceNotFound"
310
+ ), s;
239
311
  },
240
312
  rejectsWithConditionalCheckFailed() {
241
- return n(
242
- () => Promise.reject(T()),
243
- !1
244
- ), o;
313
+ return o(
314
+ () => Promise.reject(K()),
315
+ !1,
316
+ "rejectsWithConditionalCheckFailed"
317
+ ), s;
245
318
  },
246
319
  rejectsWithThrottling() {
247
- return n(() => Promise.reject(I()), !1), o;
320
+ return o(
321
+ () => Promise.reject(M()),
322
+ !1,
323
+ "rejectsWithThrottling"
324
+ ), s;
248
325
  },
249
326
  rejectsWithInternalServerError() {
250
- return n(() => Promise.reject(O()), !1), o;
327
+ return o(
328
+ () => Promise.reject(A()),
329
+ !1,
330
+ "rejectsWithInternalServerError"
331
+ ), s;
251
332
  },
252
- resolvesPaginated(r, u = {}) {
253
- const i = L(r, u);
254
- let l = 0;
255
- return n((a) => {
256
- const f = u.tokenKey || "NextToken", E = u.inputTokenKey || f, p = a[E];
257
- if (p) {
258
- const g = /token-(\d+)/.exec(p);
259
- if (g && g[1]) {
260
- const P = g[1];
261
- l = Math.floor(
262
- Number.parseInt(P, 10) / (u.pageSize || 10)
263
- );
264
- }
265
- } else
266
- l = 0;
267
- const m = (
268
- // eslint-disable-next-line security/detect-object-injection
269
- i[l] || // eslint-disable-next-line unicorn/prefer-at -- TypeScript target doesn't support Array.at() method
270
- i[i.length - 1] || i[0]
271
- );
272
- if (!m)
273
- throw new Error("No paginated responses available");
274
- return l = Math.min(l + 1, i.length - 1), Promise.resolve(m);
275
- }, !1), o;
333
+ resolvesPaginated(r, c = {}) {
334
+ const l = _(r, c);
335
+ let u = 0;
336
+ return e.debugLogger.log(
337
+ `Configured resolvesPaginated for ${t.name}`,
338
+ { pageSize: c.pageSize, itemsCount: r.length }
339
+ ), o(
340
+ (g) => {
341
+ const a = c.tokenKey || "NextToken", d = c.inputTokenKey || a, m = g[d];
342
+ if (m != null) {
343
+ const E = c.itemsKey || "Items";
344
+ let b = 0;
345
+ for (const x of l) {
346
+ const p = x[E];
347
+ if (p && p.length > 0) {
348
+ const W = p[p.length - 1];
349
+ if (JSON.stringify(W) === JSON.stringify(m)) {
350
+ u = b + 1;
351
+ break;
352
+ }
353
+ }
354
+ b++;
355
+ }
356
+ } else
357
+ u = 0;
358
+ const h = (
359
+ // eslint-disable-next-line security/detect-object-injection
360
+ l[u] || // eslint-disable-next-line unicorn/prefer-at -- TypeScript target doesn't support Array.at() method
361
+ l[l.length - 1] || l[0]
362
+ );
363
+ if (!h)
364
+ throw new Error("No paginated responses available");
365
+ return u = Math.min(u + 1, l.length - 1), Promise.resolve(h);
366
+ },
367
+ !1,
368
+ "resolvesPaginated"
369
+ ), s;
276
370
  },
277
371
  resolvesFromFile(r) {
278
- return n(() => {
279
- const u = F(r);
280
- return Promise.resolve(u);
281
- }, !1), o;
372
+ return e.debugLogger.log(
373
+ `Configured resolvesFromFile for ${t.name}`,
374
+ { filePath: r }
375
+ ), o(
376
+ () => {
377
+ const c = J(r);
378
+ return Promise.resolve(c);
379
+ },
380
+ !1,
381
+ "resolvesFromFile"
382
+ ), s;
282
383
  }
283
384
  };
284
- return o;
385
+ return s;
285
386
  }
286
- const G = (t) => {
287
- const e = {
387
+ const ee = (e) => {
388
+ const t = {
288
389
  map: /* @__PURE__ */ new WeakMap(),
289
- debugLogger: k()
290
- }, s = t.prototype, c = b.spyOn(s, "send").mockImplementation(x(e));
390
+ debugLogger: j()
391
+ }, n = e.prototype, i = v.spyOn(n, "send").mockImplementation(C(t));
291
392
  return {
292
393
  client: void 0,
293
- on: (o, r, u) => S(
294
- e,
295
- o,
394
+ on: (s, r, c) => R(
395
+ t,
396
+ s,
296
397
  r,
297
- u
398
+ c
298
399
  ),
299
400
  reset: () => {
300
- c.mockClear(), e.map = /* @__PURE__ */ new WeakMap();
401
+ t.debugLogger.log("Clearing call history (mocks preserved)"), i.mockClear();
301
402
  },
302
403
  restore: () => {
303
- c.mockRestore(), e.map = /* @__PURE__ */ new WeakMap();
404
+ t.debugLogger.log(
405
+ "Restoring original client behavior and clearing all mocks"
406
+ ), i.mockRestore(), t.map = /* @__PURE__ */ new WeakMap();
304
407
  },
305
- calls: () => c.mock.calls.map((o) => o[0]),
306
- __rawCalls: () => c.mock.calls,
408
+ calls: () => i.mock.calls.map((s) => s[0]),
409
+ __rawCalls: () => i.mock.calls,
307
410
  enableDebug: () => {
308
- y(e.debugLogger);
411
+ S(t.debugLogger);
309
412
  },
310
413
  disableDebug: () => {
311
- w(e.debugLogger);
414
+ w(t.debugLogger);
312
415
  }
313
416
  };
314
- }, H = (t) => {
315
- const e = {
417
+ }, te = (e) => {
418
+ const t = {
316
419
  map: /* @__PURE__ */ new WeakMap(),
317
- debugLogger: k()
318
- }, s = b.spyOn(t, "send").mockImplementation(x(e));
420
+ debugLogger: j()
421
+ }, n = v.spyOn(e, "send").mockImplementation(C(t));
319
422
  return {
320
- client: t,
321
- on: (n, o, r) => S(
322
- e,
323
- n,
423
+ client: e,
424
+ on: (o, s, r) => R(
425
+ t,
324
426
  o,
427
+ s,
325
428
  r
326
429
  ),
327
430
  reset: () => {
328
- s.mockClear(), e.map = /* @__PURE__ */ new WeakMap();
431
+ t.debugLogger.log(
432
+ "Clearing call history (mocks preserved) for client instance"
433
+ ), n.mockClear();
329
434
  },
330
435
  restore: () => {
331
- s.mockRestore(), e.map = /* @__PURE__ */ new WeakMap();
436
+ t.debugLogger.log(
437
+ "Restoring original client behavior and clearing all mocks for client instance"
438
+ ), n.mockRestore(), t.map = /* @__PURE__ */ new WeakMap();
332
439
  },
333
- calls: () => s.mock.calls.map((n) => n[0]),
334
- __rawCalls: () => s.mock.calls,
440
+ calls: () => n.mock.calls.map((o) => o[0]),
441
+ __rawCalls: () => n.mock.calls,
335
442
  enableDebug: () => {
336
- y(e.debugLogger);
443
+ S(t.debugLogger);
337
444
  },
338
445
  disableDebug: () => {
339
- w(e.debugLogger);
446
+ w(t.debugLogger);
340
447
  }
341
448
  };
342
449
  };
343
450
  export {
344
- Y as matchers,
345
- G as mockClient,
346
- H as mockClientInstance
451
+ ne as matchers,
452
+ ee as mockClient,
453
+ te as mockClientInstance
347
454
  };