-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhost-list-row-fixtures.ts
More file actions
55 lines (50 loc) · 1.51 KB
/
Copy pathhost-list-row-fixtures.ts
File metadata and controls
55 lines (50 loc) · 1.51 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import type { MutableRefObject } from "react";
import { vi } from "vitest";
import type { HostRowViewModel } from "../features/view-profile-filters";
import type { HostConfig, HostMetadata } from "../types";
import type { HostListRowBridgeProps } from "../components/HostListRow";
export const sampleHost: HostConfig = {
host: "mybox",
hostName: "mybox.example",
user: "deploy",
port: 22,
identityFile: "",
proxyJump: "",
proxyCommand: "",
};
export const sampleMetadata: HostMetadata = {
favorite: false,
tags: [],
lastUsedAt: null,
trustHostDefault: false,
isJumpHost: false,
};
export function sampleRow(overrides: Partial<HostRowViewModel> = {}): HostRowViewModel {
return {
host: sampleHost,
metadata: sampleMetadata,
connected: false,
displayUser: "deploy",
...overrides,
};
}
export function noopBridge(overrides: Partial<HostListRowBridgeProps> = {}): HostListRowBridgeProps {
const suppressHostClickAliasRef: MutableRefObject<string | null> = { current: null };
const missingDragPayloadLoggedRef: MutableRefObject<boolean> = { current: false };
return {
activeHost: "",
suppressHostClickAliasRef,
setContextMenu: vi.fn(),
setHostContextMenu: vi.fn(),
setHoveredHostAlias: vi.fn(),
setActiveHost: vi.fn(),
setDragOverPaneIndex: vi.fn(),
toggleFavoriteForHost: vi.fn(),
connectToHostInNewPane: vi.fn(),
setDragPayload: vi.fn(),
setDraggingKind: vi.fn(),
missingDragPayloadLoggedRef,
onEditHost: vi.fn(),
...overrides,
};
}