This repository has been archived by the owner on Jan 6, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Sebastian Lorenz <[email protected]>
- Loading branch information
1 parent
3c6b714
commit a5950d1
Showing
7 changed files
with
189 additions
and
0 deletions.
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,5 @@ | ||
--- | ||
"@effect/schema": patch | ||
--- | ||
|
||
added S.Secret |
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
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
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,24 @@ | ||
import * as S from "@effect/schema/Schema" | ||
import * as Util from "@effect/schema/test/util" | ||
import { Secret } from "effect" | ||
import { describe, it } from "vitest" | ||
|
||
describe("Schema/Secret", () => { | ||
const schema = S.Secret | ||
|
||
it("property tests", () => { | ||
Util.roundtrip(schema) | ||
}) | ||
|
||
it("decoding", () => { | ||
Util.expectParseSuccess(schema, "keep me safe", Secret.fromString("keep me safe")) | ||
}) | ||
|
||
it("encoding", () => { | ||
Util.expectEncodeSuccess( | ||
schema, | ||
Secret.fromString("keep me safe"), | ||
"keep me safe" | ||
) | ||
}) | ||
}) |
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,34 @@ | ||
import * as Pretty from "@effect/schema/Pretty" | ||
import * as S from "@effect/schema/Schema" | ||
import * as Util from "@effect/schema/test/util" | ||
import { Secret } from "effect" | ||
import { describe, expect, it } from "vitest" | ||
|
||
describe("Schema/SecretFromSelf", () => { | ||
const schema = S.SecretFromSelf | ||
|
||
it("property tests", () => { | ||
Util.roundtrip(schema) | ||
}) | ||
|
||
it("decoding", () => { | ||
Util.expectParseSuccess( | ||
schema, | ||
Secret.fromString("keep me safe"), | ||
Secret.fromString("keep me safe") | ||
) | ||
}) | ||
|
||
it("encoding", () => { | ||
Util.expectEncodeSuccess( | ||
schema, | ||
Secret.fromString("keep me safe"), | ||
Secret.fromString("keep me safe") | ||
) | ||
}) | ||
|
||
it("Pretty", () => { | ||
const pretty = Pretty.to(schema) | ||
expect(pretty(Secret.fromString("keep me safe"))).toEqual(`Secret(<redacted>)`) | ||
}) | ||
}) |