MCPcopy Create free account
hub / github.com/coder/coder / renderDashboardLayout

Function renderDashboardLayout

site/src/modules/dashboard/DashboardLayout.test.tsx:16–56  ·  view source on GitHub ↗
({
	actual,
	entitlement = "entitled",
	limit,
	permissions = MockPermissions,
	warnings,
}: {
	actual?: number;
	entitlement?: "entitled" | "grace_period" | "not_entitled";
	limit?: number;
	permissions?: typeof MockPermissions;
	warnings?: string[];
})

Source from the content-addressed store, hash-verified

14import { DashboardLayout } from "./DashboardLayout";
15
16const renderDashboardLayout = async ({
17 actual,
18 entitlement = "entitled",
19 limit,
20 permissions = MockPermissions,
21 warnings,
22}: {
23 actual?: number;
24 entitlement?: "entitled" | "grace_period" | "not_entitled";
25 limit?: number;
26 permissions?: typeof MockPermissions;
27 warnings?: string[];
28}) => {
29 server.use(
30 http.get("/api/v2/entitlements", () => {
31 return HttpResponse.json({
32 ...MockEntitlements,
33 warnings: warnings ?? MockEntitlements.warnings,
34 has_license: true,
35 refreshed_at: new Date().toISOString(),
36 features: {
37 ...MockEntitlements.features,
38 ai_governance_user_limit: {
39 entitlement,
40 enabled: true,
41 ...(actual !== undefined ? { actual } : {}),
42 ...(limit !== undefined ? { limit } : {}),
43 },
44 },
45 });
46 }),
47 http.post("/api/v2/authcheck", () => {
48 return HttpResponse.json(permissions);
49 }),
50 );
51
52 renderWithAuth(<DashboardLayout />, {
53 children: [{ element: <h1>Test page</h1> }],
54 });
55 await waitForLoaderToBeRemoved();
56};
57
58test("Show the new Coder version notification", async () => {
59 server.use(

Callers 1

Calls 3

renderWithAuthFunction · 0.90
waitForLoaderToBeRemovedFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected