FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
opencode/packages/httpapi-codegen/test/effect.ts at dev · argszero/opencode · GitHub
argszero
/
opencode
Public
forked from
anomalyco/opencode
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
opencode
/
packages
/
httpapi-codegen
/
test
/
effect.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (24 loc) · 937 Bytes
Breadcrumbs
opencode
/
packages
/
httpapi-codegen
/
test
/
effect.ts
Copy path
File metadata and controls
28 lines (24 loc) · 937 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import
{
test
}
from
"bun:test"
import
{
Cause
,
Effect
,
Exit
,
Layer
}
from
"effect"
import
type
{
Scope
}
from
"effect/Scope"
import
{
TestClock
,
TestConsole
}
from
"effect/testing"
type
Body
<
A
,
E
,
R
>
=
Effect
.
Effect
<
A
,
E
,
R
>
|
(
(
)
=>
Effect
.
Effect
<
A
,
E
,
R
>
)
const
layer
=
Layer
.
mergeAll
(
TestConsole
.
layer
,
TestClock
.
layer
(
)
)
const
effect
=
<
A
,
E
>
(
name
:
string
,
body
:
Body
<
A
,
E
,
Scope
>
,
options
?:
Parameters
<
typeof
test
>
[
2
]
)
=>
test
(
name
,
(
)
=>
Effect
.
gen
(
function
*
(
)
{
const
exit
=
yield
*
Effect
.
suspend
(
(
)
=>
(
typeof
body
===
"function"
?
body
(
)
:
body
)
)
.
pipe
(
Effect
.
scoped
,
Effect
.
provide
(
layer
)
,
Effect
.
exit
,
)
if
(
Exit
.
isFailure
(
exit
)
)
{
yield
*
Effect
.
forEach
(
Cause
.
prettyErrors
(
exit
.
cause
)
,
Effect
.
logError
,
{
discard
:
true
}
)
}
return
yield
*
exit
}
)
.
pipe
(
Effect
.
runPromise
)
,
options
,
)
export
const
it
=
{
effect
}
Back
|
FazBrowse Home
|
New Git URL