fix(tlon): Fix Zod v4 record() and @urbit/aura v3 API changes (#1631)
* fix(tlon): Fix Zod v4 record() and @urbit/aura v3 API changes
- Fix Zod v4.3.6 bug: single-arg z.record() fails with toJSONSchema()
- Use two-arg form: z.record(z.string(), schema)
- Fixes 'Cannot read properties of undefined (reading _zod)' error
- Fix @urbit/aura v3.0.0 API migration:
- unixToDa() → da.fromUnix()
- formatUd() → scot('ud', ...)
- Fixes '(0 , _aura.unixToDa) is not a function' error
These were blocking Tlon plugin loading and outbound messaging.
* fix: add tlon schema/aura tests (#1631) (thanks @arthyn)
---------
Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
32
extensions/tlon/src/config-schema.test.ts
Normal file
32
extensions/tlon/src/config-schema.test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { TlonAuthorizationSchema, TlonConfigSchema } from "./config-schema.js";
|
||||
|
||||
describe("Tlon config schema", () => {
|
||||
it("accepts channelRules with string keys", () => {
|
||||
const parsed = TlonAuthorizationSchema.parse({
|
||||
channelRules: {
|
||||
"chat/~zod/test": {
|
||||
mode: "open",
|
||||
allowedShips: ["~zod"],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(parsed.channelRules?.["chat/~zod/test"]?.mode).toBe("open");
|
||||
});
|
||||
|
||||
it("accepts accounts with string keys", () => {
|
||||
const parsed = TlonConfigSchema.parse({
|
||||
accounts: {
|
||||
primary: {
|
||||
ship: "~zod",
|
||||
url: "https://example.com",
|
||||
code: "code-123",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(parsed.accounts?.primary?.ship).toBe("~zod");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user