@jterrazz/test 6.2.0 → 6.4.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.
@@ -0,0 +1,35 @@
1
+ //#region src/builder/common/intercept/types.d.ts
2
+ /**
3
+ * An intercept trigger describes which HTTP request to match.
4
+ */
5
+ interface InterceptTrigger {
6
+ /** HTTP method to match. */
7
+ method: string;
8
+ /** URL pattern to match (string for exact prefix, RegExp for pattern). */
9
+ url: RegExp | string;
10
+ /** Optional request body matcher — the handler only fires if this returns true. */
11
+ match?: (body: unknown) => boolean;
12
+ }
13
+ /**
14
+ * An intercept response describes what to return when the trigger matches.
15
+ */
16
+ interface InterceptResponse {
17
+ /** HTTP status code (default: 200). */
18
+ status?: number;
19
+ /** Response body (will be JSON.stringified). */
20
+ body: unknown;
21
+ /** Response headers. */
22
+ headers?: Record<string, string>;
23
+ /** Delay in ms before responding (for timeout testing). */
24
+ delay?: number;
25
+ }
26
+ /**
27
+ * A fully resolved intercept entry ready to be registered with MSW.
28
+ */
29
+ interface InterceptEntry {
30
+ trigger: InterceptTrigger;
31
+ response: InterceptResponse;
32
+ }
33
+ //#endregion
34
+ export { InterceptResponse as n, InterceptTrigger as r, InterceptEntry as t };
35
+ //# sourceMappingURL=types.d.cts.map
@@ -0,0 +1,35 @@
1
+ //#region src/builder/common/intercept/types.d.ts
2
+ /**
3
+ * An intercept trigger describes which HTTP request to match.
4
+ */
5
+ interface InterceptTrigger {
6
+ /** HTTP method to match. */
7
+ method: string;
8
+ /** URL pattern to match (string for exact prefix, RegExp for pattern). */
9
+ url: RegExp | string;
10
+ /** Optional request body matcher — the handler only fires if this returns true. */
11
+ match?: (body: unknown) => boolean;
12
+ }
13
+ /**
14
+ * An intercept response describes what to return when the trigger matches.
15
+ */
16
+ interface InterceptResponse {
17
+ /** HTTP status code (default: 200). */
18
+ status?: number;
19
+ /** Response body (will be JSON.stringified). */
20
+ body: unknown;
21
+ /** Response headers. */
22
+ headers?: Record<string, string>;
23
+ /** Delay in ms before responding (for timeout testing). */
24
+ delay?: number;
25
+ }
26
+ /**
27
+ * A fully resolved intercept entry ready to be registered with MSW.
28
+ */
29
+ interface InterceptEntry {
30
+ trigger: InterceptTrigger;
31
+ response: InterceptResponse;
32
+ }
33
+ //#endregion
34
+ export { InterceptResponse as n, InterceptTrigger as r, InterceptEntry as t };
35
+ //# sourceMappingURL=types.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jterrazz/test",
3
- "version": "6.2.0",
3
+ "version": "6.4.1",
4
4
  "author": "Jean-Baptiste Terrazzoni <contact@jterrazz.com>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,6 +22,10 @@
22
22
  "./mock": {
23
23
  "require": "./dist/mock.cjs",
24
24
  "import": "./dist/mock.js"
25
+ },
26
+ "./intercept": {
27
+ "require": "./dist/intercept.cjs",
28
+ "import": "./dist/intercept.js"
25
29
  }
26
30
  },
27
31
  "publishConfig": {
@@ -51,6 +55,7 @@
51
55
  "@types/node": "^25.5.0",
52
56
  "@types/pg": "^8.20.0",
53
57
  "hono": "^4.12.9",
58
+ "msw": "^2.13.3",
54
59
  "tsdown": "^0.21.8",
55
60
  "vitest": "^4.1.2"
56
61
  },