fix: make empty runtime state reachable
This commit is contained in:
parent
c2fb20b066
commit
35855f018f
3 changed files with 44 additions and 15 deletions
|
|
@ -20,7 +20,7 @@ describe("dashboard runtime loader", () => {
|
|||
test("seeds and loads the active dashboard from sqlite", async () => {
|
||||
const store = await createTestStore();
|
||||
|
||||
const runtime = loadDashboardRuntime(store);
|
||||
const runtime = loadDashboardRuntime(store, { seedIfEmpty: true });
|
||||
|
||||
expect(runtime.state).toBe("ready");
|
||||
if (runtime.state !== "ready") throw new Error("expected ready dashboard");
|
||||
|
|
@ -46,6 +46,17 @@ describe("dashboard runtime loader", () => {
|
|||
expect(runtime.document.metadata.title).toBe(genericDashboardFixture.metadata.title);
|
||||
expect(store.listRevisions()).toHaveLength(1);
|
||||
});
|
||||
|
||||
test("returns empty state when no dashboard is active and seeding is disabled", async () => {
|
||||
const store = await createTestStore();
|
||||
|
||||
const runtime = loadDashboardRuntime(store);
|
||||
|
||||
expect(runtime.state).toBe("empty");
|
||||
if (runtime.state !== "empty") throw new Error("expected empty dashboard");
|
||||
expect(runtime.title).toBe("No Dashboard Model");
|
||||
expect(store.listRevisions()).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
async function createTestStore() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue