MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / TestShouldRestoreVMSelection

Function TestShouldRestoreVMSelection

internal/ui/components/selection_test.go:9–77  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestShouldRestoreVMSelection(t *testing.T) {
10 tests := []struct {
11 name string
12 hasVM bool
13 vmID int
14 vmNode string
15 current *api.VM
16 want bool
17 }{
18 {
19 name: "restore when no current selection",
20 hasVM: true,
21 vmID: 101,
22 vmNode: "pve1",
23 current: nil,
24 want: true,
25 },
26 {
27 name: "restore when selection unchanged",
28 hasVM: true,
29 vmID: 101,
30 vmNode: "pve1",
31 current: &api.VM{
32 ID: 101,
33 Node: "pve1",
34 },
35 want: true,
36 },
37 {
38 name: "do not restore when user changed vm selection",
39 hasVM: true,
40 vmID: 101,
41 vmNode: "pve1",
42 current: &api.VM{
43 ID: 202,
44 Node: "pve1",
45 },
46 want: false,
47 },
48 {
49 name: "do not restore when user changed node selection",
50 hasVM: true,
51 vmID: 101,
52 vmNode: "pve1",
53 current: &api.VM{
54 ID: 101,
55 Node: "pve2",
56 },
57 want: false,
58 },
59 {
60 name: "disabled restore",
61 hasVM: false,
62 vmID: 101,
63 vmNode: "pve1",
64 current: nil,
65 want: false,
66 },

Callers

nothing calls this directly

Calls 2

shouldRestoreVMSelectionFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected