You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/opencode/test/server/httpapi-exercise/dsl.ts
+26Lines changed: 26 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@ import { Effect } from "effect"
2
2
import{looksJson}from"./assertions"
3
3
importtype{
4
4
ActiveScenario,
5
+
AuthPolicy,
5
6
BuilderState,
6
7
CallResult,
7
8
Comparison,
@@ -21,11 +22,13 @@ class ScenarioBuilder<S = undefined> {
21
22
path,
22
23
name,
23
24
project: {git: true},
25
+
// oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- The unseeded builder state is intentionally undefined until `.seeded(...)` narrows it.
24
26
seed: ()=>Effect.succeed(undefinedasS),
25
27
request: (ctx)=>({ path,headers: ctx.headers()}),
26
28
capture: "full",
27
29
mutates: false,
28
30
reset: true,
31
+
auth: "protected",
29
32
}
30
33
}
31
34
@@ -57,6 +60,26 @@ class ScenarioBuilder<S = undefined> {
57
60
returnthis.clone({capture: "stream"})
58
61
}
59
62
63
+
protected(){
64
+
returnthis.auth("protected")
65
+
}
66
+
67
+
public(){
68
+
returnthis.auth("public")
69
+
}
70
+
71
+
publicBypass(){
72
+
returnthis.auth("public-bypass")
73
+
}
74
+
75
+
ticketBypass(){
76
+
returnthis.auth("ticket-bypass")
77
+
}
78
+
79
+
privateauth(auth: AuthPolicy){
80
+
returnthis.clone({ auth })
81
+
}
82
+
60
83
/** Assert a non-JSON or shape-only response. */
61
84
ok(status=200,compare: Comparison="status"){
62
85
returnthis.done(compare,(_ctx,result)=>
@@ -128,12 +151,15 @@ class ScenarioBuilder<S = undefined> {
128
151
name: state.name,
129
152
project: state.project,
130
153
seed: state.seed,
154
+
// oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion -- `.seeded(...)` preserves the paired request/state type inside the builder.
0 commit comments