@spoosh/test-utils 0.1.5 → 0.1.7

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/dist/index.cjs CHANGED
@@ -45,19 +45,17 @@ function createMockContext(options = {}) {
45
45
  stateManager = (0, import_core.createStateManager)(),
46
46
  eventEmitter = (0, import_core.createEventEmitter)(),
47
47
  queryKey = '{"method":"GET","path":["test"]}',
48
- path = ["test"],
48
+ path = "test",
49
49
  method = "GET",
50
50
  tags = ["test"],
51
51
  operationType = "read",
52
52
  pluginOptions,
53
53
  forceRefetch,
54
54
  hookId,
55
- state: stateOverrides,
56
- requestOptions = {},
57
- metadata = /* @__PURE__ */ new Map(),
55
+ request = {},
56
+ temp = /* @__PURE__ */ new Map(),
58
57
  plugins = { get: import_vitest.vi.fn() }
59
58
  } = options;
60
- const state = createState(stateOverrides);
61
59
  return {
62
60
  operationType,
63
61
  path,
@@ -65,14 +63,10 @@ function createMockContext(options = {}) {
65
63
  queryKey,
66
64
  tags,
67
65
  requestTimestamp: Date.now(),
68
- requestOptions,
69
- state,
70
- metadata,
71
- abort: import_vitest.vi.fn(),
66
+ request,
67
+ temp,
72
68
  stateManager,
73
69
  eventEmitter,
74
- headers: {},
75
- setHeaders: import_vitest.vi.fn(),
76
70
  plugins,
77
71
  pluginOptions,
78
72
  forceRefetch,
package/dist/index.d.cts CHANGED
@@ -10,7 +10,7 @@ type MockContextOptions<TData = unknown, TError = unknown> = {
10
10
  stateManager?: StateManager;
11
11
  eventEmitter?: EventEmitter;
12
12
  queryKey?: string;
13
- path?: string[];
13
+ path?: string;
14
14
  method?: string;
15
15
  tags?: string[];
16
16
  operationType?: "read" | "write" | "infiniteRead";
@@ -18,9 +18,9 @@ type MockContextOptions<TData = unknown, TError = unknown> = {
18
18
  forceRefetch?: boolean;
19
19
  hookId?: string;
20
20
  state?: Partial<OperationState<TData, TError>>;
21
- requestOptions?: Record<string, unknown>;
22
- /** Custom metadata map for the context */
23
- metadata?: Map<string, unknown>;
21
+ request?: Record<string, unknown>;
22
+ /** Custom temp map for the context */
23
+ temp?: Map<string, unknown>;
24
24
  /** Custom plugins object with get function */
25
25
  plugins?: {
26
26
  get: ReturnType<typeof vi.fn>;
@@ -29,7 +29,7 @@ type MockContextOptions<TData = unknown, TError = unknown> = {
29
29
  /**
30
30
  * Creates a mock PluginContext for testing plugins.
31
31
  */
32
- declare function createMockContext<TData = unknown, TError = unknown>(options?: MockContextOptions<TData, TError>): PluginContext<TData, TError>;
32
+ declare function createMockContext<TData = unknown, TError = unknown>(options?: MockContextOptions<TData, TError>): PluginContext;
33
33
  /**
34
34
  * Creates a mock SpooshResponse.
35
35
  */
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ type MockContextOptions<TData = unknown, TError = unknown> = {
10
10
  stateManager?: StateManager;
11
11
  eventEmitter?: EventEmitter;
12
12
  queryKey?: string;
13
- path?: string[];
13
+ path?: string;
14
14
  method?: string;
15
15
  tags?: string[];
16
16
  operationType?: "read" | "write" | "infiniteRead";
@@ -18,9 +18,9 @@ type MockContextOptions<TData = unknown, TError = unknown> = {
18
18
  forceRefetch?: boolean;
19
19
  hookId?: string;
20
20
  state?: Partial<OperationState<TData, TError>>;
21
- requestOptions?: Record<string, unknown>;
22
- /** Custom metadata map for the context */
23
- metadata?: Map<string, unknown>;
21
+ request?: Record<string, unknown>;
22
+ /** Custom temp map for the context */
23
+ temp?: Map<string, unknown>;
24
24
  /** Custom plugins object with get function */
25
25
  plugins?: {
26
26
  get: ReturnType<typeof vi.fn>;
@@ -29,7 +29,7 @@ type MockContextOptions<TData = unknown, TError = unknown> = {
29
29
  /**
30
30
  * Creates a mock PluginContext for testing plugins.
31
31
  */
32
- declare function createMockContext<TData = unknown, TError = unknown>(options?: MockContextOptions<TData, TError>): PluginContext<TData, TError>;
32
+ declare function createMockContext<TData = unknown, TError = unknown>(options?: MockContextOptions<TData, TError>): PluginContext;
33
33
  /**
34
34
  * Creates a mock SpooshResponse.
35
35
  */
package/dist/index.js CHANGED
@@ -17,19 +17,17 @@ function createMockContext(options = {}) {
17
17
  stateManager = createStateManager(),
18
18
  eventEmitter = createEventEmitter(),
19
19
  queryKey = '{"method":"GET","path":["test"]}',
20
- path = ["test"],
20
+ path = "test",
21
21
  method = "GET",
22
22
  tags = ["test"],
23
23
  operationType = "read",
24
24
  pluginOptions,
25
25
  forceRefetch,
26
26
  hookId,
27
- state: stateOverrides,
28
- requestOptions = {},
29
- metadata = /* @__PURE__ */ new Map(),
27
+ request = {},
28
+ temp = /* @__PURE__ */ new Map(),
30
29
  plugins = { get: vi.fn() }
31
30
  } = options;
32
- const state = createState(stateOverrides);
33
31
  return {
34
32
  operationType,
35
33
  path,
@@ -37,14 +35,10 @@ function createMockContext(options = {}) {
37
35
  queryKey,
38
36
  tags,
39
37
  requestTimestamp: Date.now(),
40
- requestOptions,
41
- state,
42
- metadata,
43
- abort: vi.fn(),
38
+ request,
39
+ temp,
44
40
  stateManager,
45
41
  eventEmitter,
46
- headers: {},
47
- setHeaders: vi.fn(),
48
42
  plugins,
49
43
  pluginOptions,
50
44
  forceRefetch,
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@spoosh/test-utils",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Test utilities for Spoosh plugins",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/nxnom/spoosh.git",
8
+ "url": "git+https://github.com/spooshdev/spoosh.git",
9
9
  "directory": "packages/test-utils"
10
10
  },
11
11
  "bugs": {
12
- "url": "https://github.com/nxnom/spoosh/issues"
12
+ "url": "https://github.com/spooshdev/spoosh/issues"
13
13
  },
14
14
  "homepage": "https://spoosh.dev",
15
15
  "keywords": [
@@ -42,7 +42,7 @@
42
42
  "dist"
43
43
  ],
44
44
  "dependencies": {
45
- "@spoosh/core": "0.4.2"
45
+ "@spoosh/core": "0.11.1"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "vitest": ">=1.0.0"