@griffin-app/griffin-ts 0.1.7 → 0.1.9

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 (72) hide show
  1. package/ASSERTIONS_QUICK_REF.md +14 -2
  2. package/README.md +103 -72
  3. package/dist/assertions.d.ts +94 -64
  4. package/dist/assertions.d.ts.map +1 -1
  5. package/dist/assertions.js +169 -102
  6. package/dist/assertions.js.map +1 -1
  7. package/dist/builder.d.ts +16 -16
  8. package/dist/builder.d.ts.map +1 -1
  9. package/dist/builder.js +11 -14
  10. package/dist/builder.js.map +1 -1
  11. package/dist/builder.test.d.ts +2 -0
  12. package/dist/builder.test.d.ts.map +1 -0
  13. package/dist/builder.test.js +607 -0
  14. package/dist/builder.test.js.map +1 -0
  15. package/dist/example.js +3 -3
  16. package/dist/example.js.map +1 -1
  17. package/dist/frequency.test.d.ts +2 -0
  18. package/dist/frequency.test.d.ts.map +1 -0
  19. package/dist/frequency.test.js +110 -0
  20. package/dist/frequency.test.js.map +1 -0
  21. package/dist/index.d.ts +5 -5
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +2 -2
  24. package/dist/index.js.map +1 -1
  25. package/dist/schema-exports.d.ts +1 -1
  26. package/dist/schema-exports.d.ts.map +1 -1
  27. package/dist/schema-exports.js +2 -2
  28. package/dist/schema-exports.js.map +1 -1
  29. package/dist/schema.d.ts +419 -251
  30. package/dist/schema.d.ts.map +1 -1
  31. package/dist/schema.js +147 -111
  32. package/dist/schema.js.map +1 -1
  33. package/dist/secrets.d.ts +1 -15
  34. package/dist/secrets.d.ts.map +1 -1
  35. package/dist/secrets.js +0 -6
  36. package/dist/secrets.js.map +1 -1
  37. package/dist/secrets.test.d.ts +2 -0
  38. package/dist/secrets.test.d.ts.map +1 -0
  39. package/dist/secrets.test.js +242 -0
  40. package/dist/secrets.test.js.map +1 -0
  41. package/dist/sequential-builder.d.ts +8 -10
  42. package/dist/sequential-builder.d.ts.map +1 -1
  43. package/dist/sequential-builder.js +8 -5
  44. package/dist/sequential-builder.js.map +1 -1
  45. package/dist/sequential-builder.test.d.ts +2 -0
  46. package/dist/sequential-builder.test.d.ts.map +1 -0
  47. package/dist/sequential-builder.test.js +520 -0
  48. package/dist/sequential-builder.test.js.map +1 -0
  49. package/dist/type-exports.d.ts +1 -1
  50. package/dist/type-exports.d.ts.map +1 -1
  51. package/dist/variable.d.ts +1 -1
  52. package/dist/variable.test.d.ts +2 -0
  53. package/dist/variable.test.d.ts.map +1 -0
  54. package/dist/variable.test.js +254 -0
  55. package/dist/variable.test.js.map +1 -0
  56. package/package.json +1 -1
  57. package/src/assertions.ts +321 -119
  58. package/src/builder.test.ts +751 -0
  59. package/src/builder.ts +30 -34
  60. package/src/example.ts +3 -3
  61. package/src/frequency.test.ts +191 -0
  62. package/src/index.ts +15 -14
  63. package/src/schema-exports.ts +6 -7
  64. package/src/schema.ts +198 -132
  65. package/src/secrets.test.ts +299 -0
  66. package/src/secrets.ts +1 -17
  67. package/src/sequential-builder.test.ts +562 -0
  68. package/src/sequential-builder.ts +25 -27
  69. package/src/type-exports.ts +5 -6
  70. package/src/variable.test.ts +334 -0
  71. package/src/variable.ts +1 -1
  72. package/vitest.config.ts +14 -0
@@ -8,13 +8,16 @@
8
8
  ])
9
9
  ```
10
10
 
11
- ## Accessors
11
+ ## Accessors (Subjects)
12
12
 
13
13
  | Accessor | Description | Example |
14
14
  | ---------- | -------------------- | --------------------------------------- |
15
- | `.body` | Response body (JSON) | `state["node"].body["data"]["id"]` |
15
+ | `.body` | Response body | `state["node"].body["data"]["id"]` |
16
16
  | `.headers` | Response headers | `state["node"].headers["content-type"]` |
17
17
  | `.status` | HTTP status code | `state["node"].status` |
18
+ | `.latency` | Request latency (ms) | `state["node"].latency` |
19
+
20
+ **Note:** For body assertions, the response type is automatically detected and defaults to JSON. Path traversal uses JSONPath for JSON responses.
18
21
 
19
22
  ## Array Access
20
23
 
@@ -75,6 +78,14 @@ Assert(state["node"].status).lessThan(400); // Any success
75
78
  Assert(state["node"].status).not.equals(500); // Not server error
76
79
  ```
77
80
 
81
+ ### Latency Checks
82
+
83
+ ```typescript
84
+ Assert(state["node"].latency).lessThan(500); // Response time under 500ms
85
+ Assert(state["node"].latency).lessThanOrEqual(1000); // Max 1 second
86
+ Assert(state["node"].latency).greaterThan(0); // Sanity check
87
+ ```
88
+
78
89
  ### Existence Checks
79
90
 
80
91
  ```typescript
@@ -151,6 +162,7 @@ TypeScript provides autocomplete and errors:
151
162
  | Task | Code |
152
163
  | ----------------- | -------------------------------------------------------- |
153
164
  | Status is 200 | `Assert(state["n"].status).equals(200)` |
165
+ | Latency < 500ms | `Assert(state["n"].latency).lessThan(500)` |
154
166
  | Body field exists | `Assert(state["n"].body["x"]).not.isNull()` |
155
167
  | String contains | `Assert(state["n"].body["msg"]).contains("ok")` |
156
168
  | Number in range | `Assert(state["n"].body["age"]).greaterThanOrEqual(18)` |
package/README.md CHANGED
@@ -36,27 +36,27 @@ griffin provides two builder APIs:
36
36
  The sequential builder automatically connects steps in order - no need to manage edges manually.
37
37
 
38
38
  ```typescript
39
- import { GET, createTestBuilder, JSON, Frequency } from "griffin-ts";
39
+ import { GET, createTestBuilder, JSON, Frequency, Assert } from "griffin-ts";
40
40
 
41
41
  const plan = createTestBuilder({
42
42
  name: "health-check",
43
- frequency: Frequency.every(1).minute(),
43
+ endpoint_host: "https://api.example.com",
44
44
  })
45
- .request({
45
+ .endpoint("health", {
46
46
  method: GET,
47
47
  response_format: JSON,
48
48
  path: "/health",
49
49
  })
50
- .assert([
51
- { type: "status", expected: 200 },
52
- { type: "body", expected: { status: "ok" } },
50
+ .assert((state) => [
51
+ Assert(state["health"].status).equals(200),
52
+ Assert(state["health"].body["status"]).equals("ok"),
53
53
  ])
54
- .build();
54
+ .build({ frequency: Frequency.every(1).minute() });
55
55
 
56
56
  export default plan;
57
57
  ```
58
58
 
59
- #### Sequential Example with Waits
59
+ #### Sequential Example with Waits and Assertions
60
60
 
61
61
  ```typescript
62
62
  import {
@@ -66,30 +66,35 @@ import {
66
66
  JSON,
67
67
  Frequency,
68
68
  Wait,
69
+ Assert,
69
70
  } from "griffin-ts";
70
71
 
71
72
  const plan = createTestBuilder({
72
73
  name: "create-and-verify-user",
73
- frequency: Frequency.every(5).minute(),
74
+ endpoint_host: "https://api.example.com",
74
75
  })
75
- .request({
76
+ .endpoint("create_user", {
76
77
  method: POST,
77
78
  response_format: JSON,
78
79
  path: "/api/v1/users",
79
80
  body: { name: "Test User", email: "test@example.com" },
80
81
  })
81
- .assert([{ type: "status", expected: 201 }])
82
+ .assert((state) => [
83
+ Assert(state["create_user"].status).equals(201),
84
+ Assert(state["create_user"].body["id"]).not.isNull(),
85
+ ])
82
86
  .wait(Wait.seconds(2))
83
- .request({
87
+ .endpoint("get_user", {
84
88
  method: GET,
85
89
  response_format: JSON,
86
90
  path: "/api/v1/users/test@example.com",
87
91
  })
88
- .assert([
89
- { type: "status", expected: 200 },
90
- { type: "body.name", expected: "Test User" },
92
+ .assert((state) => [
93
+ Assert(state["get_user"].status).equals(200),
94
+ Assert(state["get_user"].body["name"]).equals("Test User"),
95
+ Assert(state["get_user"].latency).lessThan(500),
91
96
  ])
92
- .build();
97
+ .build({ frequency: Frequency.every(5).minute() });
93
98
 
94
99
  export default plan;
95
100
  ```
@@ -103,45 +108,41 @@ import {
103
108
  GET,
104
109
  POST,
105
110
  createGraphBuilder,
106
- Endpoint,
107
- Assertion,
108
- WaitNode,
109
111
  JSON,
110
112
  START,
111
113
  END,
112
114
  Frequency,
113
115
  Wait,
116
+ Assert,
114
117
  } from "griffin-ts";
115
118
 
116
119
  const plan = createGraphBuilder({
117
120
  name: "foo-bar-check",
118
- frequency: Frequency.every(1).minute(),
121
+ endpoint_host: "https://api.example.com",
119
122
  })
120
- .addNode(
121
- "create_foo",
122
- Endpoint({
123
- method: POST,
124
- response_format: JSON,
125
- path: "/api/v1/foo",
126
- body: { name: "test", value: 42 },
127
- }),
128
- )
129
- .addNode(
130
- "get_foo",
131
- Endpoint({
132
- method: GET,
133
- response_format: JSON,
134
- path: "/api/v1/foo/1",
135
- }),
136
- )
137
- .addNode("wait_between", WaitNode(Wait.seconds(2)))
138
- .addNode("check_status", Assertion([{ type: "status", expected: 200 }]))
123
+ .addHttpRequest("create_foo", {
124
+ method: POST,
125
+ response_format: JSON,
126
+ path: "/api/v1/foo",
127
+ body: { name: "test", value: 42 },
128
+ })
129
+ .addWait("wait_between", Wait.seconds(2))
130
+ .addHttpRequest("get_foo", {
131
+ method: GET,
132
+ response_format: JSON,
133
+ path: "/api/v1/foo/1",
134
+ })
135
+ .addAssertion("check_response", (state) => [
136
+ Assert(state["get_foo"].status).equals(200),
137
+ Assert(state["get_foo"].body["value"]).equals(42),
138
+ Assert(state["get_foo"].latency).lessThan(1000),
139
+ ])
139
140
  .addEdge(START, "create_foo")
140
141
  .addEdge("create_foo", "wait_between")
141
142
  .addEdge("wait_between", "get_foo")
142
- .addEdge("get_foo", "check_status")
143
- .addEdge("check_status", END)
144
- .build();
143
+ .addEdge("get_foo", "check_response")
144
+ .addEdge("check_response", END)
145
+ .build({ frequency: Frequency.every(1).minute() });
145
146
 
146
147
  export default plan;
147
148
  ```
@@ -153,13 +154,20 @@ griffin supports secure secret management for API keys, tokens, and other creden
153
154
  #### With Sequential Builder
154
155
 
155
156
  ```typescript
156
- import { GET, createTestBuilder, JSON, Frequency, secret } from "griffin-ts";
157
+ import {
158
+ GET,
159
+ createTestBuilder,
160
+ JSON,
161
+ Frequency,
162
+ secret,
163
+ Assert,
164
+ } from "griffin-ts";
157
165
 
158
166
  const plan = createTestBuilder({
159
167
  name: "authenticated-check",
160
- frequency: Frequency.every(5).minute(),
168
+ endpoint_host: "https://api.example.com",
161
169
  })
162
- .request({
170
+ .endpoint("protected", {
163
171
  method: GET,
164
172
  response_format: JSON,
165
173
  path: "/api/protected",
@@ -176,8 +184,8 @@ const plan = createTestBuilder({
176
184
  apiKey: secret("env:API_KEY"),
177
185
  },
178
186
  })
179
- .assert([{ type: "status", expected: 200 }])
180
- .build();
187
+ .assert((state) => [Assert(state["protected"].status).equals(200)])
188
+ .build({ frequency: Frequency.every(5).minute() });
181
189
 
182
190
  export default plan;
183
191
  ```
@@ -188,36 +196,34 @@ export default plan;
188
196
  import {
189
197
  GET,
190
198
  createGraphBuilder,
191
- Endpoint,
192
- Assertion,
193
199
  JSON,
194
200
  START,
195
201
  END,
196
202
  Frequency,
197
203
  secret,
204
+ Assert,
198
205
  } from "griffin-ts";
199
206
 
200
207
  const plan = createGraphBuilder({
201
208
  name: "authenticated-check",
202
- frequency: Frequency.every(5).minute(),
209
+ endpoint_host: "https://api.example.com",
203
210
  })
204
- .addNode(
205
- "authenticated_request",
206
- Endpoint({
207
- method: GET,
208
- response_format: JSON,
209
- path: "/api/protected",
210
- headers: {
211
- "X-API-Key": secret("env:API_KEY"),
212
- Authorization: secret("aws:prod/api-token"),
213
- },
214
- }),
215
- )
216
- .addNode("verify", Assertion([{ type: "status", expected: 200 }]))
211
+ .addHttpRequest("authenticated_request", {
212
+ method: GET,
213
+ response_format: JSON,
214
+ path: "/api/protected",
215
+ headers: {
216
+ "X-API-Key": secret("env:API_KEY"),
217
+ Authorization: secret("aws:prod/api-token"),
218
+ },
219
+ })
220
+ .addAssertion("verify", (state) => [
221
+ Assert(state["authenticated_request"].status).equals(200),
222
+ ])
217
223
  .addEdge(START, "authenticated_request")
218
224
  .addEdge("authenticated_request", "verify")
219
225
  .addEdge("verify", END)
220
- .build();
226
+ .build({ frequency: Frequency.every(5).minute() });
221
227
 
222
228
  export default plan;
223
229
  ```
@@ -252,22 +258,47 @@ See the [griffin-runner CONFIG.md](../griffin-runner/CONFIG.md) for configuratio
252
258
 
253
259
  #### Sequential Builder Methods
254
260
 
255
- - **`.request(config)`**: Add an HTTP endpoint request
256
- - **`.wait(duration)`**: Add a delay (use `Wait.seconds(n)` or `Wait.minutes(n)`)
257
- - **`.assert(assertions)`**: Add assertions to validate responses
258
- - **`.build()`**: Generate the final test plan
261
+ - **`.endpoint(id, config)`**: Add an HTTP endpoint request with a unique identifier
262
+ - **`.wait(duration)`**: Add a delay (use `Wait.seconds(n)`, `Wait.minutes(n)`, or `Wait.milliseconds(n)`)
263
+ - **`.assert(fn)`**: Add assertions using a function that receives the state proxy and returns an array of assertions
264
+ - **`.build(options)`**: Generate the final test plan with frequency configuration
259
265
 
260
266
  #### Graph Builder Methods
261
267
 
262
- - **`.addNode(name, node)`**: Add a node to the graph using `Endpoint()`, `WaitNode()`, or `Assertion()`
268
+ - **`.addHttpRequest(id, config)`**: Add an endpoint node to the graph
269
+ - **`.addWait(id, duration)`**: Add a wait node to the graph
270
+ - **`.addAssertion(id, fn)`**: Add an assertion node using a function that receives the state proxy
263
271
  - **`.addEdge(from, to)`**: Connect two nodes (use `START` and `END` constants for entry/exit)
264
- - **`.build()`**: Generate the final test plan (validates all nodes are connected)
272
+ - **`.build(options)`**: Generate the final test plan (validates all nodes are connected)
273
+
274
+ #### Assertions
275
+
276
+ Use the `Assert()` function with the state proxy to create type-safe assertions:
277
+
278
+ ```typescript
279
+ .assert((state) => [
280
+ // Status checks
281
+ Assert(state["node"].status).equals(200),
282
+
283
+ // Latency checks
284
+ Assert(state["node"].latency).lessThan(500),
285
+
286
+ // Body assertions (JSONPath automatically detected)
287
+ Assert(state["node"].body["id"]).not.isNull(),
288
+ Assert(state["node"].body["name"]).equals("test"),
289
+
290
+ // Header assertions
291
+ Assert(state["node"].headers["content-type"]).contains("json"),
292
+ ])
293
+ ```
294
+
295
+ See [ASSERTIONS_QUICK_REF.md](./ASSERTIONS_QUICK_REF.md) for the complete assertion API.
265
296
 
266
297
  #### General
267
298
 
268
- - **Frequency**: Use `Frequency.every(n).minute()`, `.hour()`, or `.day()` (note the parentheses)
299
+ - **Frequency**: Use `Frequency.every(n).minute()`, `.hour()`, or `.day()` in the `build()` options
269
300
  - **Secrets**: Use `secret("provider:path")` to reference secrets that are resolved at runtime
270
- - **Assertions**: Currently in development - assertion functions are stored but not yet evaluated during execution
301
+ - **Response Types**: JSON (default), XML, and TEXT response formats are supported
271
302
 
272
303
  ## Output
273
304
 
@@ -6,82 +6,107 @@
6
6
  * - Assert: Builder for creating assertions with fluent API
7
7
  * - Support for unary and binary predicates with negation
8
8
  */
9
+ import { type Assertion, AssertionSubject, ResponseFormat } from "./schema.js";
9
10
  /**
10
- * Identifies which node and which part of its result we're asserting on
11
+ * Descriptor for body assertions - supports nested JSONPath access
11
12
  */
12
- export interface PathDescriptor {
13
+ export interface BodyDescriptor {
13
14
  nodeId: string;
14
- accessor: "body" | "headers" | "status";
15
+ subject: AssertionSubject.BODY;
15
16
  path: string[];
17
+ responseType: ResponseFormat;
16
18
  }
17
19
  /**
18
- * Unary predicates that check a property without comparing to a value
20
+ * Descriptor for header assertions - single header name, no nesting
19
21
  */
20
- export declare enum UnaryPredicate {
21
- IS_NULL = "IS_NULL",
22
- IS_NOT_NULL = "IS_NOT_NULL",
23
- IS_TRUE = "IS_TRUE",
24
- IS_FALSE = "IS_FALSE",
25
- IS_EMPTY = "IS_EMPTY",
26
- IS_NOT_EMPTY = "IS_NOT_EMPTY"
22
+ export interface HeaderDescriptor {
23
+ nodeId: string;
24
+ subject: AssertionSubject.HEADERS;
25
+ headerName: string;
27
26
  }
28
27
  /**
29
- * Binary predicate operators that compare against an expected value
30
- */
31
- export declare enum BinaryPredicateOperator {
32
- EQUAL = "EQUAL",
33
- NOT_EQUAL = "NOT_EQUAL",
34
- GREATER_THAN = "GREATER_THAN",
35
- LESS_THAN = "LESS_THAN",
36
- GREATER_THAN_OR_EQUAL = "GREATER_THAN_OR_EQUAL",
37
- LESS_THAN_OR_EQUAL = "LESS_THAN_OR_EQUAL",
38
- CONTAINS = "CONTAINS",
39
- NOT_CONTAINS = "NOT_CONTAINS",
40
- STARTS_WITH = "STARTS_WITH",
41
- NOT_STARTS_WITH = "NOT_STARTS_WITH",
42
- ENDS_WITH = "ENDS_WITH",
43
- NOT_ENDS_WITH = "NOT_ENDS_WITH"
28
+ * Descriptor for status assertions - no path needed
29
+ */
30
+ export interface StatusDescriptor {
31
+ nodeId: string;
32
+ subject: AssertionSubject.STATUS;
33
+ }
34
+ /**
35
+ * Descriptor for latency assertions - no path needed
36
+ */
37
+ export interface LatencyDescriptor {
38
+ nodeId: string;
39
+ subject: AssertionSubject.LATENCY;
44
40
  }
41
+ /**
42
+ * Union of all assertion descriptors
43
+ */
44
+ export type AssertionDescriptor = BodyDescriptor | HeaderDescriptor | StatusDescriptor | LatencyDescriptor;
45
45
  /**
46
46
  * Binary predicate with operator and expected value
47
47
  */
48
- export interface BinaryPredicate {
49
- operator: BinaryPredicateOperator;
50
- expected: unknown;
48
+ /**
49
+ * Symbol used to store descriptor metadata in proxy objects
50
+ */
51
+ declare const DESCRIPTOR_SYMBOL: unique symbol;
52
+ /**
53
+ * Internal interface for proxy objects that carry a body descriptor
54
+ */
55
+ interface ProxyWithBodyDescriptor {
56
+ [DESCRIPTOR_SYMBOL]: BodyDescriptor;
51
57
  }
52
58
  /**
53
- * Serialized assertion ready for execution
59
+ * Internal interface for proxy objects that carry a header descriptor
54
60
  */
55
- export interface SerializedAssertion {
56
- nodeId: string;
57
- accessor: "body" | "headers" | "status";
58
- path: string[];
59
- predicate: UnaryPredicate | BinaryPredicate;
61
+ interface ProxyWithHeaderDescriptor {
62
+ [DESCRIPTOR_SYMBOL]: HeaderDescriptor;
60
63
  }
61
64
  /**
62
- * Symbol used to store path metadata in proxy objects
65
+ * Internal interface for proxy objects that carry a status descriptor
63
66
  */
64
- declare const PATH_SYMBOL: unique symbol;
67
+ interface ProxyWithStatusDescriptor {
68
+ [DESCRIPTOR_SYMBOL]: StatusDescriptor;
69
+ }
65
70
  /**
66
- * Internal interface for proxy objects that carry path information
71
+ * Internal interface for proxy objects that carry a latency descriptor
67
72
  */
68
- interface ProxyWithPath {
69
- [PATH_SYMBOL]: PathDescriptor;
73
+ interface ProxyWithLatencyDescriptor {
74
+ [DESCRIPTOR_SYMBOL]: LatencyDescriptor;
70
75
  }
71
76
  /**
72
- * Proxy for accessing nested properties within a node result accessor (body, headers, status)
73
- * Note: The 'at' method is available at runtime but typed as NestedProxy for simplicity
77
+ * Proxy for accessing nested properties within a body.
78
+ * Supports arbitrary depth: body["data"]["users"][0]["name"]
79
+ */
80
+ export type BodyProxy = ProxyWithBodyDescriptor & {
81
+ [key: string]: BodyProxy;
82
+ };
83
+ /**
84
+ * Terminal proxy for a single header value. No further nesting allowed.
85
+ */
86
+ export type HeaderValueProxy = ProxyWithHeaderDescriptor;
87
+ /**
88
+ * Proxy for accessing header values. Only allows one level of access.
89
+ * e.g., headers["content-type"] returns a HeaderValueProxy
74
90
  */
75
- export type NestedProxy = ProxyWithPath & {
76
- [key: string]: NestedProxy;
91
+ export type HeadersProxy = {
92
+ [key: string]: HeaderValueProxy;
77
93
  };
78
94
  /**
79
- * Proxy for a node result with body, headers, and status accessors
95
+ * Terminal proxy for status. No further nesting allowed.
96
+ */
97
+ export type StatusProxy = ProxyWithStatusDescriptor;
98
+ /**
99
+ * Terminal proxy for latency. No further nesting allowed.
100
+ */
101
+ export type LatencyProxy = ProxyWithLatencyDescriptor;
102
+ /**
103
+ * Proxy for a node result with body, headers, status, and latency accessors
80
104
  */
81
105
  export type NodeResultProxy = {
82
- body: NestedProxy;
83
- headers: NestedProxy;
84
- status: NestedProxy;
106
+ body: BodyProxy;
107
+ headers: HeadersProxy;
108
+ status: StatusProxy;
109
+ latency: LatencyProxy;
85
110
  };
86
111
  /**
87
112
  * State proxy that maps node names to their result proxies
@@ -96,7 +121,7 @@ export declare function createStateProxy<NodeNames extends string>(nodeNames: No
96
121
  export declare class AssertBuilder {
97
122
  private descriptor;
98
123
  private negated;
99
- constructor(descriptor: PathDescriptor);
124
+ constructor(descriptor: AssertionDescriptor);
100
125
  /**
101
126
  * Negation modifier - flips the meaning of the subsequent predicate
102
127
  *
@@ -105,21 +130,26 @@ export declare class AssertBuilder {
105
130
  * Assert(state["node"].body["name"]).not.equals("") // NOT_EQUAL
106
131
  */
107
132
  get not(): this;
108
- isNull(): SerializedAssertion;
109
- isDefined(): SerializedAssertion;
110
- isTrue(): SerializedAssertion;
111
- isFalse(): SerializedAssertion;
112
- isEmpty(): SerializedAssertion;
113
- equals(expected: unknown): SerializedAssertion;
114
- greaterThan(expected: number): SerializedAssertion;
115
- lessThan(expected: number): SerializedAssertion;
116
- greaterThanOrEqual(expected: number): SerializedAssertion;
117
- lessThanOrEqual(expected: number): SerializedAssertion;
118
- contains(expected: string): SerializedAssertion;
119
- startsWith(expected: string): SerializedAssertion;
120
- endsWith(expected: string): SerializedAssertion;
121
- private createAssertion;
133
+ isNull(): Assertion;
134
+ isDefined(): Assertion;
135
+ isTrue(): Assertion;
136
+ isFalse(): Assertion;
137
+ isEmpty(): Assertion;
138
+ equals(expected: unknown): Assertion;
139
+ greaterThan(expected: number): Assertion;
140
+ lessThan(expected: number): Assertion;
141
+ greaterThanOrEqual(expected: number): Assertion;
142
+ lessThanOrEqual(expected: number): Assertion;
143
+ contains(expected: string): Assertion;
144
+ startsWith(expected: string): Assertion;
145
+ endsWith(expected: string): Assertion;
146
+ private createUnaryAssertion;
147
+ private createBinaryAssertion;
122
148
  }
149
+ /**
150
+ * Union of all assertable proxy types
151
+ */
152
+ export type AssertableProxy = BodyProxy | HeaderValueProxy | StatusProxy | LatencyProxy;
123
153
  /**
124
154
  * Creates an assertion builder from a state proxy reference
125
155
  *
@@ -131,6 +161,6 @@ export declare class AssertBuilder {
131
161
  * Assert(state["create_user"].status).equals(201)
132
162
  * Assert(state["create_user"].headers["content-type"]).contains("application/json")
133
163
  */
134
- export declare function Assert(proxyRef: NestedProxy): AssertBuilder;
164
+ export declare function Assert(proxyRef: AssertableProxy): AssertBuilder;
135
165
  export {};
136
166
  //# sourceMappingURL=assertions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../src/assertions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH;;GAEG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