summaryrefslogtreecommitdiffhomepage
path: root/src/features/plugins/logic/test-fixtures.ts
blob: e7b3f5d2e1359fbe362341a293eb52a191f9d33e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import type { PluginListResponse } from "@dispatch/transport-contract";
import type { PluginNode } from "./types";
import { pluginNodes } from "./view-model";

/**
 * Build a PluginNode directly (the graph-logic tests' fixture). Defaults:
 * loaded, standard tier, no deps.
 */
export function node(overrides: Partial<PluginNode> = {}): PluginNode {
  return {
    id: "p",
    name: "p",
    version: "1.0.0",
    tier: "standard",
    trust: "bundled",
    loaded: true,
    locked: false,
    dependsOn: [],
    reason: null,
    section: "loaded",
    ...overrides,
  };
}

/** An empty `GET /plugins` response. */
export function emptyListResponse(): PluginListResponse {
  return { loaded: [], disabledWithReason: [], discovered: [], missing: [] };
}

export { pluginNodes };