@zudojs/testing 1.1.2 → 1.2.2

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 (96) hide show
  1. package/README.md +138 -2
  2. package/dist/assertions/httpAssertions.core.d.ts +2 -2
  3. package/dist/httpTestClient/httpTestClient.cookieJar.d.ts +30 -0
  4. package/dist/httpTestClient/httpTestClient.cookieJar.js +107 -0
  5. package/dist/httpTestClient/httpTestClient.factory.d.ts +25 -0
  6. package/dist/httpTestClient/httpTestClient.factory.js +84 -0
  7. package/dist/httpTestClient/httpTestClient.target.d.ts +16 -0
  8. package/dist/httpTestClient/httpTestClient.target.js +80 -0
  9. package/dist/httpTestClient/httpTestClient.type.d.ts +74 -0
  10. package/dist/httpTestClient/httpTestClient.type.js +5 -0
  11. package/dist/httpTestClient/httpTestRequest/httpTestRequest.core.d.ts +10 -0
  12. package/dist/httpTestClient/httpTestRequest/httpTestRequest.core.js +97 -0
  13. package/dist/httpTestClient/httpTestRequest/httpTestRequest.encode.d.ts +26 -0
  14. package/dist/httpTestClient/httpTestRequest/httpTestRequest.encode.js +73 -0
  15. package/dist/httpTestClient/httpTestRequest/httpTestRequest.execute.d.ts +26 -0
  16. package/dist/httpTestClient/httpTestRequest/httpTestRequest.execute.js +58 -0
  17. package/dist/httpTestClient/httpTestRequest/httpTestRequest.type.d.ts +53 -0
  18. package/dist/httpTestClient/httpTestRequest/httpTestRequest.type.js +5 -0
  19. package/dist/httpTestClient/httpTestRequest/index.d.ts +13 -0
  20. package/dist/httpTestClient/httpTestRequest/index.js +10 -0
  21. package/dist/httpTestClient/httpTestResponse/httpTestResponse.core.d.ts +15 -0
  22. package/dist/httpTestClient/httpTestResponse/httpTestResponse.core.js +71 -0
  23. package/dist/httpTestClient/httpTestResponse/httpTestResponse.expect.d.ts +19 -0
  24. package/dist/httpTestClient/httpTestResponse/httpTestResponse.expect.js +74 -0
  25. package/dist/httpTestClient/httpTestResponse/httpTestResponse.match.d.ts +15 -0
  26. package/dist/httpTestClient/httpTestResponse/httpTestResponse.match.js +52 -0
  27. package/dist/httpTestClient/httpTestResponse/httpTestResponse.type.d.ts +44 -0
  28. package/dist/httpTestClient/httpTestResponse/httpTestResponse.type.js +5 -0
  29. package/dist/httpTestClient/httpTestResponse/index.d.ts +12 -0
  30. package/dist/httpTestClient/httpTestResponse/index.js +10 -0
  31. package/dist/httpTestClient/httpTestTransport/httpTestTransport.fetch.d.ts +15 -0
  32. package/dist/httpTestClient/httpTestTransport/httpTestTransport.fetch.js +65 -0
  33. package/dist/httpTestClient/httpTestTransport/httpTestTransport.node.d.ts +18 -0
  34. package/dist/httpTestClient/httpTestTransport/httpTestTransport.node.js +94 -0
  35. package/dist/httpTestClient/httpTestTransport/httpTestTransport.server.d.ts +23 -0
  36. package/dist/httpTestClient/httpTestTransport/httpTestTransport.server.js +76 -0
  37. package/dist/httpTestClient/httpTestTransport/httpTestTransport.type.d.ts +46 -0
  38. package/dist/httpTestClient/httpTestTransport/httpTestTransport.type.js +9 -0
  39. package/dist/httpTestClient/httpTestTransport/httpTestTransport.zudo.d.ts +25 -0
  40. package/dist/httpTestClient/httpTestTransport/httpTestTransport.zudo.js +71 -0
  41. package/dist/httpTestClient/httpTestTransport/index.d.ts +15 -0
  42. package/dist/httpTestClient/httpTestTransport/index.js +13 -0
  43. package/dist/httpTestClient/index.d.ts +18 -0
  44. package/dist/httpTestClient/index.js +13 -0
  45. package/dist/httpTesting/httpRequest/httpRequest.builder.d.ts +13 -0
  46. package/dist/httpTesting/httpRequest/httpRequest.builder.js +64 -0
  47. package/dist/httpTesting/httpRequest/httpRequest.factory.d.ts +17 -0
  48. package/dist/httpTesting/httpRequest/httpRequest.factory.js +25 -0
  49. package/dist/httpTesting/{httpRequest.core.d.ts → httpRequest/httpRequest.type.d.ts} +6 -21
  50. package/dist/httpTesting/httpRequest/httpRequest.type.js +5 -0
  51. package/dist/httpTesting/httpRequest/index.d.ts +10 -0
  52. package/dist/httpTesting/httpRequest/index.js +9 -0
  53. package/dist/httpTesting/{httpResponse.helpers.d.ts → httpResponse/httpResponse.helpers.d.ts} +1 -1
  54. package/dist/httpTesting/{httpResponse.type.d.ts → httpResponse/httpResponse.type.d.ts} +1 -1
  55. package/dist/httpTesting/httpResponse/index.d.ts +10 -0
  56. package/dist/httpTesting/httpResponse/index.js +9 -0
  57. package/dist/httpTesting/index.d.ts +6 -6
  58. package/dist/httpTesting/index.js +4 -4
  59. package/dist/index.d.ts +1 -0
  60. package/dist/index.js +1 -0
  61. package/dist/mocking/spy.core.d.ts +6 -1
  62. package/dist/mocking/spy.core.js +1 -3
  63. package/dist/mocking/stub.core.d.ts +3 -1
  64. package/dist/mocking/stub.core.js +15 -2
  65. package/dist/testApplication/index.d.ts +1 -1
  66. package/dist/testApplication/index.js +1 -1
  67. package/dist/testApplication/testApplication.core.d.ts +35 -5
  68. package/dist/testApplication/testApplication.core.js +18 -3
  69. package/dist/testEventBus/index.d.ts +2 -2
  70. package/dist/testEventBus/index.js +1 -1
  71. package/dist/testEventBus/testEventBus.core.d.ts +12 -45
  72. package/dist/testEventBus/testEventBus.core.js +55 -46
  73. package/dist/testEventBus/testEventBus.type.d.ts +40 -0
  74. package/dist/testEventBus/testEventBus.type.js +2 -0
  75. package/dist/testMessageBus/index.d.ts +1 -1
  76. package/dist/testMessageBus/index.js +1 -1
  77. package/dist/testMessageBus/testMessageBus.core.d.ts +20 -24
  78. package/dist/testMessageBus/testMessageBus.core.js +45 -47
  79. package/dist/testQueue/index.d.ts +2 -2
  80. package/dist/testQueue/index.js +1 -1
  81. package/dist/testQueue/testQueue.core.d.ts +19 -38
  82. package/dist/testQueue/testQueue.core.js +34 -30
  83. package/dist/testQueue/testQueue.type.d.ts +30 -0
  84. package/dist/testQueue/testQueue.type.js +2 -0
  85. package/dist/testQueue/testQueue.view.d.ts +37 -0
  86. package/dist/testQueue/testQueue.view.js +44 -0
  87. package/dist/testStorage/testStorageMemory.core.d.ts +6 -1
  88. package/dist/testStorage/testStorageMemory.core.js +13 -3
  89. package/package.json +17 -17
  90. package/dist/httpTesting/httpRequest.core.js +0 -114
  91. package/dist/httpTesting/httpStatusCode.type.d.ts +0 -10
  92. package/dist/httpTesting/httpStatusCode.type.js +0 -9
  93. /package/dist/httpTesting/{httpResponse.core.d.ts → httpResponse/httpResponse.core.d.ts} +0 -0
  94. /package/dist/httpTesting/{httpResponse.core.js → httpResponse/httpResponse.core.js} +0 -0
  95. /package/dist/httpTesting/{httpResponse.helpers.js → httpResponse/httpResponse.helpers.js} +0 -0
  96. /package/dist/httpTesting/{httpResponse.type.js → httpResponse/httpResponse.type.js} +0 -0
@@ -1,114 +0,0 @@
1
- /**
2
- * HTTP request builder for testing.
3
- *
4
- * Provides a fluent API for constructing test HTTP requests.
5
- */
6
- /**
7
- * Creates a new HTTP request builder.
8
- *
9
- * @returns An HTTPRequestBuilder instance.
10
- */
11
- export function createTestHTTPRequest() {
12
- let method = "GET";
13
- let path = "/";
14
- const headers = new Headers();
15
- const query = {};
16
- const params = {};
17
- let body = undefined;
18
- const builder = {
19
- GET: (p) => {
20
- method = "GET";
21
- path = p;
22
- return builder;
23
- },
24
- POST: (p) => {
25
- method = "POST";
26
- path = p;
27
- return builder;
28
- },
29
- PUT: (p) => {
30
- method = "PUT";
31
- path = p;
32
- return builder;
33
- },
34
- PATCH: (p) => {
35
- method = "PATCH";
36
- path = p;
37
- return builder;
38
- },
39
- DELETE: (p) => {
40
- method = "DELETE";
41
- path = p;
42
- return builder;
43
- },
44
- HEAD: (p) => {
45
- method = "HEAD";
46
- path = p;
47
- return builder;
48
- },
49
- OPTIONS: (p) => {
50
- method = "OPTIONS";
51
- path = p;
52
- return builder;
53
- },
54
- withHeader: (key, value) => {
55
- headers.set(key.toLowerCase(), value);
56
- return builder;
57
- },
58
- withHeaders: (h) => {
59
- if (h instanceof Headers) {
60
- h.forEach((value, key) => {
61
- headers.set(key, value);
62
- });
63
- }
64
- else {
65
- for (const [key, value] of Object.entries(h)) {
66
- headers.set(key.toLowerCase(), value);
67
- }
68
- }
69
- return builder;
70
- },
71
- withQuery: (q) => {
72
- for (const [key, value] of Object.entries(q)) {
73
- query[key] = value;
74
- }
75
- return builder;
76
- },
77
- withParam: (key, value) => {
78
- params[key] = value;
79
- return builder;
80
- },
81
- withBody: (b) => {
82
- body = b;
83
- return builder;
84
- },
85
- build: () => ({
86
- method,
87
- path,
88
- headers: new Headers(headers),
89
- query: { ...query },
90
- body,
91
- params: { ...params },
92
- }),
93
- };
94
- return builder;
95
- }
96
- /**
97
- * Creates a simple test HTTP request without the builder pattern.
98
- *
99
- * @param method - HTTP method.
100
- * @param path - Request path.
101
- * @param options - Optional headers, query, and body.
102
- * @returns A TestHTTPRequest instance.
103
- */
104
- export function createHTTPRequest(method, path, options = {}) {
105
- return {
106
- method,
107
- path,
108
- headers: new Headers(options.headers),
109
- query: options.query ?? {},
110
- body: options.body,
111
- params: options.params ?? {},
112
- };
113
- }
114
- //# sourceMappingURL=httpRequest.core.js.map
@@ -1,10 +0,0 @@
1
- /**
2
- * @zudojs/testing — HTTP status code type.
3
- *
4
- * Local definition of HTTPStatusCode for testing purposes.
5
- * When @zudojs/http builds cleanly, this should be replaced
6
- * with an import from @zudojs/http.
7
- */
8
- /** HTTP status code number. */
9
- export type HTTPStatusCode = number;
10
- //# sourceMappingURL=httpStatusCode.type.d.ts.map
@@ -1,9 +0,0 @@
1
- /**
2
- * @zudojs/testing — HTTP status code type.
3
- *
4
- * Local definition of HTTPStatusCode for testing purposes.
5
- * When @zudojs/http builds cleanly, this should be replaced
6
- * with an import from @zudojs/http.
7
- */
8
- export {};
9
- //# sourceMappingURL=httpStatusCode.type.js.map