MCPcopy Create free account
hub / github.com/jetify-com/devbox / TestUpdateNewSysInfoIsAdded

Function TestUpdateNewSysInfoIsAdded

internal/devbox/update_test.go:67–124  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

65}
66
67func TestUpdateNewSysInfoIsAdded(t *testing.T) {
68 devbox := devboxForTesting(t)
69
70 raw := "hello@1.2.3"
71 sys1 := currentSystem(t)
72 sys2 := "system2"
73 devPkg := devpkg.PackageFromStringWithDefaults(raw, nil)
74 resolved := &lock.Package{
75 Resolved: "resolved-flake-reference",
76 Systems: map[string]*lock.SystemInfo{
77 sys1: {
78 Outputs: []lock.Output{
79 {
80 Name: "out",
81 Default: true,
82 Path: "store_path1",
83 },
84 },
85 },
86 sys2: {
87 Outputs: []lock.Output{
88 {
89 Name: "out",
90 Default: true,
91 Path: "store_path2",
92 },
93 },
94 },
95 },
96 }
97 lockfile := &lock.File{
98 Packages: map[string]*lock.Package{
99 raw: {
100 Resolved: "resolved-flake-reference",
101 Systems: map[string]*lock.SystemInfo{
102 sys1: {
103 Outputs: []lock.Output{
104 {
105 Name: "out",
106 Default: true,
107 Path: "store_path1",
108 },
109 },
110 },
111 // Missing sys2
112 },
113 },
114 },
115 }
116
117 err := devbox.mergeResolvedPackageToLockfile(devPkg, resolved, lockfile)
118 require.NoError(t, err, "update failed")
119
120 require.Contains(t, lockfile.Packages, raw)
121 require.Contains(t, lockfile.Packages[raw].Systems, sys1)
122 require.Contains(t, lockfile.Packages[raw].Systems, sys2)
123 require.Equal(t, "store_path2", lockfile.Packages[raw].Systems[sys2].Outputs[0].Path)
124}

Callers

nothing calls this directly

Calls 4

devboxForTestingFunction · 0.85
currentSystemFunction · 0.85

Tested by

no test coverage detected