-
-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New methods
extractAll
and extractSchema
to UrlParams
(added `S…
…chema.BooleanFromString`) (#3900) Co-authored-by: Tim <[email protected]>
- Loading branch information
1 parent
2ae5a9a
commit 9d7542a
Showing
5 changed files
with
166 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@effect/platform": patch | ||
"effect": minor | ||
--- | ||
|
||
New methods `extractAll` and `extractSchema` to `UrlParams` (added `Schema.BooleanFromString`). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/effect/test/Schema/Schema/Boolean/BooleanFromString.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as S from "effect/Schema" | ||
import * as Util from "effect/test/Schema/TestUtils" | ||
import { describe, it } from "vitest" | ||
|
||
describe("BooleanFromString", () => { | ||
const schema = S.BooleanFromString | ||
it("decoding", async () => { | ||
await Util.expectDecodeUnknownSuccess(schema, "true", true) | ||
await Util.expectDecodeUnknownSuccess(schema, "false", false) | ||
await Util.expectDecodeUnknownFailure( | ||
schema, | ||
"a", | ||
`BooleanFromString | ||
└─ Encoded side transformation failure | ||
└─ "true" | "false" | ||
├─ Expected "true", actual "a" | ||
└─ Expected "false", actual "a"` | ||
) | ||
}) | ||
|
||
it("encoding", async () => { | ||
await Util.expectEncodeSuccess(schema, true, "true") | ||
await Util.expectEncodeSuccess(schema, false, "false") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters