Skip to content

Commit bf9b2e5

Browse files
committed
Fix failing xcode watcher unit test
1 parent 232b284 commit bf9b2e5

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

Diff for: test/unit-tests/toolchain/SelectedXcodeWatcher.test.ts

+20-1
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,20 @@ import * as vscode from "vscode";
1616
import { expect } from "chai";
1717
import { SelectedXcodeWatcher } from "../../../src/toolchain/SelectedXcodeWatcher";
1818
import { SwiftOutputChannel } from "../../../src/ui/SwiftOutputChannel";
19-
import { instance, MockedObject, mockFn, mockGlobalObject, mockObject } from "../../MockUtils";
19+
import {
20+
instance,
21+
MockedObject,
22+
mockFn,
23+
mockGlobalObject,
24+
mockGlobalValue,
25+
mockObject,
26+
} from "../../MockUtils";
27+
import configuration from "../../../src/configuration";
2028

2129
suite("Selected Xcode Watcher", () => {
2230
const mockedVSCodeWindow = mockGlobalObject(vscode, "window");
2331
let mockOutputChannel: MockedObject<SwiftOutputChannel>;
32+
const pathConfig = mockGlobalValue(configuration, "path");
2433

2534
setup(function () {
2635
// Xcode only exists on macOS, so the SelectedXcodeWatcher is macOS-only.
@@ -31,6 +40,8 @@ suite("Selected Xcode Watcher", () => {
3140
mockOutputChannel = mockObject<SwiftOutputChannel>({
3241
appendLine: mockFn(),
3342
});
43+
44+
pathConfig.setValue("");
3445
});
3546

3647
async function run(symLinksOnCallback: (string | undefined)[]) {
@@ -72,4 +83,12 @@ suite("Selected Xcode Watcher", () => {
7283
"Reload Extensions"
7384
);
7485
});
86+
87+
test("Ignores when path is explicitly set", async () => {
88+
pathConfig.setValue("/path/to/swift/bin");
89+
90+
await run(["/foo", "/bar"]);
91+
92+
expect(mockedVSCodeWindow.showWarningMessage).to.have.not.been.called;
93+
});
7594
});

0 commit comments

Comments
 (0)