Reorganize repo structure and standards references

This commit is contained in:
david committed 2026-06-29 05:03:42 +02:00
1 parent 3cb93a81be
commit be2054274d
5885 files changed
+2588 -195

No files matched your search

@@ -0,0 +1,36 @@
import { describe, expect, it, vi } from "vitest";
import { findLegacyWidgetById, type LegacyWidgetReaderClient } from "./widgets.server.js";
describe("findLegacyWidgetById", () => {
it("fetches the legacy widget record by id and tenant", async () => {
const widget = {
id: "widget_123",
createdAt: new Date("2026-01-01T00:00:00.000Z"),
updatedAt: new Date("2026-01-02T00:00:00.000Z"),
tenantId: "tenant_123",
name: "Support",
appearance: "{}",
metadata: "{}",
};
const findFirst = vi.fn().mockResolvedValue(widget);
const client: LegacyWidgetReaderClient = {
widget: { findFirst },
};
await expect(findLegacyWidgetById({ widgetId: "widget_123", tenantId: "tenant_123" }, client)).resolves.toBe(widget);
expect(findFirst).toHaveBeenCalledWith({
where: { id: "widget_123", tenantId: "tenant_123" },
});
});
it("returns null when the widget does not exist", async () => {
const client: LegacyWidgetReaderClient = {
widget: {
findFirst: vi.fn().mockResolvedValue(null),
},
};
await expect(findLegacyWidgetById({ widgetId: "missing", tenantId: "tenant_123" }, client)).resolves.toBeNull();
});
});