Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .bumpy/valimock-1-7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@saeris/valicon": minor
---

Rebuild the `@saeris/valicon/valimock` entry on Valimock 1.7: `lexiconMocks` is now a set of Valimock options (`stringActions`, `stringFormats` and a `lazy` custom mock) to spread into `new Valimock()`, and the `stringActions` and `stringFormats` tables are exported separately. Valimock 1.7.1 or newer is required.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ if (post.kind === "schema") {
import { Valimock } from "valimock";
import { lexiconMocks } from "@saeris/valicon/valimock";

const mock = new Valimock({ customMocks: lexiconMocks });
const mock = new Valimock({ ...lexiconMocks, seed: 42 });
mock.mock(post);
// { $type: "app.bsky.feed.post", text: "...", createdAt: "2024-...", reply: { root: { uri: "at://did:plc:...", cid: "bafyrei..." } } }
```

DIDs, handles, TIDs, CIDs, AT URIs and timestamps come out looking real, `knownValues` and `accept` lists are honored, and unions always produce one of their declared variants. The generators (`mockDid()`, `mockHandle()`, `mockTid()`, ...) are exported for direct use.
DIDs, handles, TIDs, CIDs, AT URIs and timestamps come out looking real, `knownValues` and `accept` lists are honored, and unions always produce one of their declared variants. `lexiconMocks` is a set of Valimock options (`stringActions`, `stringFormats` and a `lazy` custom mock), so it spreads alongside your own; the generators (`mockDid()`, `mockHandle()`, `mockTid()`, ...) are exported for direct use. Requires Valimock 1.7.1 or newer.

## 🎛 Configuration

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"peerDependencies": {
"@faker-js/faker": ">=9.0.0",
"valibot": "^1.5.0",
"valimock": ">=1.6.0"
"valimock": ">=1.7.1"
},
"peerDependenciesMeta": {
"@faker-js/faker": {
Expand All @@ -68,7 +68,7 @@
"deoptkit": "^0.1.0",
"typescript": "^6.0.3",
"valibot": "^1.5.0",
"valimock": "^1.6.0",
"valimock": "^1.7.1",
"vite-plus": "catalog:",
"vitest": "catalog:"
},
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/valimock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("lexiconMocks", () => {
resolve: resolvePlaceholder
});
const mock = new Valimock({
customMocks: lexiconMocks,
...lexiconMocks,
seed: 42,
onWarn: () => {}
}).mock;
Expand Down
Loading
Loading