@@ -81,15 +81,20 @@ describe("maybeRepairSandboxImages", () => {
|
81 | 81 | await maybeRepairSandboxImages(createSandboxConfig(params.mode), mockRuntime, mockPrompter); |
82 | 82 | } |
83 | 83 | |
| 84 | +function firstNoteCall() { |
| 85 | +const noteCall = note.mock.calls[0]; |
| 86 | +if (noteCall === undefined) { |
| 87 | +throw new Error("expected sandbox warning note"); |
| 88 | +} |
| 89 | +return noteCall; |
| 90 | +} |
| 91 | + |
84 | 92 | it("warns when sandbox mode is enabled but Docker is not available", async () => { |
85 | 93 | await runSandboxRepair({ mode: "non-main", dockerAvailable: false }); |
86 | 94 | |
87 | 95 | // The warning should clearly indicate sandbox is enabled but won't work |
88 | 96 | expect(note).toHaveBeenCalled(); |
89 | | -const noteCall = note.mock.calls.at(0); |
90 | | -if (noteCall === undefined) { |
91 | | -throw new Error("expected sandbox warning note"); |
92 | | -} |
| 97 | +const noteCall = firstNoteCall(); |
93 | 98 | const message = noteCall[0] as string; |
94 | 99 | |
95 | 100 | // The message should warn that sandbox mode won't function, not just "skipping checks" |
@@ -102,10 +107,7 @@ describe("maybeRepairSandboxImages", () => {
|
102 | 107 | await runSandboxRepair({ mode: "all", dockerAvailable: false }); |
103 | 108 | |
104 | 109 | expect(note).toHaveBeenCalled(); |
105 | | -const noteCall = note.mock.calls.at(0); |
106 | | -if (noteCall === undefined) { |
107 | | -throw new Error("expected sandbox warning note"); |
108 | | -} |
| 110 | +const noteCall = firstNoteCall(); |
109 | 111 | const message = noteCall[0] as string; |
110 | 112 | |
111 | 113 | // Should warn about the impact on sandbox functionality |
|