Skip to content

Commit 908fcb5

Browse files
d-csclaude
andcommitted
test(webapp): cover the dedicated-shard misconfiguration throw in selectRunOpsTopology
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 20f0ee3 commit 908fcb5

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

apps/webapp/test/runOpsDbTopology.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,24 @@ describe("selectRunOpsTopology (pure)", () => {
193193
expect(buildShardWriter).not.toHaveBeenCalled();
194194
expect(buildShardReplica).not.toHaveBeenCalled();
195195
});
196+
197+
it("throws when a non-aliased shard has no url (guards the shard.url non-null assertion)", () => {
198+
expect(() =>
199+
selectRunOpsTopology(
200+
{ ...baseSplit, shards: [{ key: "a" }] },
201+
{ ...baseBuilders(), buildShardWriter: vi.fn(), buildShardReplica: vi.fn() }
202+
)
203+
).toThrow(/shard "a" needs a url/);
204+
});
205+
206+
it("throws when a non-aliased shard is configured but the shard builders are absent", () => {
207+
expect(() =>
208+
selectRunOpsTopology(
209+
{ ...baseSplit, shards: [{ key: "a", url: "postgres://a" }] },
210+
baseBuilders()
211+
)
212+
).toThrow(/shard "a" needs a url and shard builders/);
213+
});
196214
});
197215

198216
describe("sameDatabaseTarget", () => {

0 commit comments

Comments
 (0)