Skip to content

Commit 1d4646b

Browse files
committed
docs(plugin)!: update for probitas-client breaking changes
Response body accessors changed from methods to properties in probitas-client PR #65. Updated all examples to use property syntax (json, data, text, etc.) and recommend dot-notation for keyPath over array syntax in common cases. BREAKING CHANGE: Plugin version bumped to 0.2.0 to reflect probitas-client API changes. Users must update response accessor syntax from method calls to property access.
1 parent 3acf16b commit 1d4646b

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
{
22
"name": "probitas",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "Probitas scenario testing framework integration for Claude Code",
55
"author": {
66
"name": "jsr-probitas",
77
"url": "https://github.com/jsr-probitas"
88
},
99
"repository": "https://github.com/jsr-probitas/claude-plugins",
10-
"keywords": ["testing", "integration-testing", "scenario", "deno"],
10+
"keywords": [
11+
"testing",
12+
"integration-testing",
13+
"scenario",
14+
"deno"
15+
],
1116
"license": "MIT"
1217
}

plugins/probitas/agents/scenario-writer.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default scenario("Test name", { tags: ["..."] })
1818
.step("Step name", async (ctx) => {
1919
const res = await ctx.resources.http.post("/endpoint", { body: {} });
2020
expect(res).toBeOk().toHaveStatus(200);
21-
return res.json<{ id: number }>()!;
21+
return res.json as { id: number } | null;
2222
})
2323
.build();
2424
```
@@ -119,36 +119,41 @@ expect(res)
119119
.toHaveDataMatching({ statusCode: 0 })
120120
.toHaveDataProperty("metadata");
121121

122-
return res.data<{ metadata?: Record<string, unknown> }>()!;
122+
return res.data as { metadata?: Record<string, unknown> } | null;
123123
```
124124

125-
**For nested property paths, use array syntax:**
125+
**For nested property paths, use dot-notation strings:**
126126

127127
```typescript
128-
// ✅ CORRECT - array syntax for nested paths
128+
// ✅ CORRECT - dot-notation for nested paths
129129
expect(res)
130130
.toBeOk()
131131
.toHaveDataProperty("Metadata")
132-
.not.toHaveDataProperty(["Metadata", "x-internal-token"]);
132+
.not.toHaveDataProperty("Metadata.x-internal-token");
133133
```
134134

135+
**Use array syntax only when property names contain dots:**
136+
135137
```typescript
136-
// ❌ WRONG - dot-notation for nested paths (NOT SUPPORTED)
137-
expect(res).not.toHaveDataProperty("Metadata.x-internal-token");
138+
// ✅ CORRECT - array syntax when property name contains "."
139+
expect(res)
140+
.toBeOk()
141+
.not.toHaveDataProperty(["api.internal", "token"]); // "api.internal" is the actual property name
142+
```
138143

144+
```typescript
139145
// ❌ WRONG - split expect calls
140146
expect(res).toHaveDataMatching({ statusCode: 0 });
141-
const data = res.data<...>()!; // Don't extract between expects!
147+
const data = res.data as ...; // Don't extract between expects!
142148
expect(res).toHaveDataProperty("metadata");
143149

144150
// ❌ WRONG - separate expect for .not
145151
expect(res).toHaveDataProperty("metadata");
146-
expect(res).not.toHaveDataProperty(["Metadata", "x-internal-token"]); // Chain it!
152+
expect(res).not.toHaveDataProperty("Metadata.x-internal-token"); // Chain it!
147153
```
148154

149155
**DO NOT GUESS API PATTERNS:**
150156

151-
- DO NOT infer dot-notation paths (e.g., `"metadata.field"`) unless documented
152157
- DO NOT assume array index syntax unless documented
153158
- DO NOT guess method signatures or options
154159
- If unsure, fetch the specific API docs from links below
@@ -180,10 +185,10 @@ client.http.createHttpClient({
180185
};
181186
})
182187

183-
// ❌ Unnecessary type casting
184-
const data = res.json() as { id: number };
185-
// ✅ CORRECT
188+
// ❌ Old syntax (deprecated)
186189
const data = res.json<{ id: number }>()!;
190+
// ✅ CORRECT - json is now a property returning any
191+
const data = res.json as { id: number } | null;
187192
```
188193

189194
### Best Practices

0 commit comments

Comments
 (0)