Skip to content

Commit bacad95

Browse files
authored
test(raft): guard optional runtime config schema (#107563)
1 parent 37b6855 commit bacad95

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎extensions/raft/src/accounts.test.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import { raftChannelConfigSchema } from "./config-schema.js";
55
import { raftSetupPlugin } from "./setup.js";
66

77
const originalProfile = process.env.RAFT_PROFILE;
8+
const runtimeConfigSchema = raftChannelConfigSchema.runtime;
9+
if (!runtimeConfigSchema) {
10+
throw new Error("expected Raft runtime config schema");
11+
}
812

913
afterEach(() => {
1014
if (originalProfile === undefined) {
@@ -75,16 +79,16 @@ describe("Raft account resolution", () => {
7579
});
7680

7781
it("accepts the supported single and multi-account fields only", () => {
78-
expect(raftChannelConfigSchema.runtime.safeParse({ profile: "default" }).success).toBe(true);
82+
expect(runtimeConfigSchema.safeParse({ profile: "default" }).success).toBe(true);
7983
expect(
80-
raftChannelConfigSchema.runtime.safeParse({
84+
runtimeConfigSchema.safeParse({
8185
accounts: {
8286
support: {
8387
profile: "support",
8488
},
8589
},
8690
}).success,
8791
).toBe(true);
88-
expect(raftChannelConfigSchema.runtime.safeParse({ bridgePort: 3000 }).success).toBe(false);
92+
expect(runtimeConfigSchema.safeParse({ bridgePort: 3000 }).success).toBe(false);
8993
});
9094
});

0 commit comments

Comments
 (0)