fix(housekeeping): serialize workspace client props
This commit is contained in:
1 parent
8a31556d51
commit
cb77b2d3b9
7 files changed
+59
-15
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
anyCapability,
|
||||
type HousekeepingWidgetDefinition,
|
||||
ok,
|
||||
} from "../../foundation/contracts";
|
||||
import { toOperationsWidgetOptions } from "./personalization-model";
|
||||
|
||||
describe("toOperationsWidgetOptions", () => {
|
||||
it("projects provider definitions to a serializable client view model", () => {
|
||||
const load = vi.fn(async () => ok({ count: 1 }, "widget"));
|
||||
const definitions: readonly HousekeepingWidgetDefinition[] = [
|
||||
{
|
||||
id: "people.queue",
|
||||
owner: "people",
|
||||
capability: anyCapability("admin.users.view"),
|
||||
kind: "mandatory",
|
||||
load,
|
||||
},
|
||||
];
|
||||
|
||||
const options = toOperationsWidgetOptions(definitions);
|
||||
|
||||
expect(options).toEqual([{ id: "people.queue", kind: "mandatory" }]);
|
||||
expect(structuredClone(options)).toEqual(options);
|
||||
expect(options[0]).not.toHaveProperty("load");
|
||||
expect(load).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user