Skip to content

Commit e0d47f8

Browse files
committed
fix build tests
1 parent e6729c0 commit e0d47f8

File tree

4 files changed

+7
-38
lines changed

4 files changed

+7
-38
lines changed

Sources/nnex/Controllers/BuildController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extension BuildController {
4545
// MARK: - PublishBuilder
4646
extension BuildController {
4747
func buildExecutable(projectFolder: any Directory, buildType: BuildType, clean: Bool, outputLocation: BuildOutputLocation?, extraBuildArgs: [String], testCommand: HomebrewFormula.TestCommand?) throws -> BuildResult {
48-
let outputLocation = try selectOutputLocation(buildType: buildType)
48+
let outputLocation = outputLocation ?? .currentDirectory(buildType)
4949
let config = try makeBuildConfig(for: projectFolder, buildType: buildType, clean: clean, extraArgs: extraBuildArgs, testCommand: testCommand)
5050

5151
return try buildService.buildExecutable(config: config, outputLocation: outputLocation)

Sources/nnex/Publish/Adapters/ArtifactDelegateAdapter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ extension ArtifactDelegateAdapter: ArtifactDelegate {
2525
}
2626

2727
func buildExecutable(projectFolder: any Directory, buildType: BuildType, extraBuildArgs: [String], testCommand: HomebrewFormula.TestCommand?) throws -> BuildResult {
28-
return try buildController.buildExecutable(projectFolder: projectFolder, buildType: buildType, clean: true, outputLocation: .currentDirectory(buildType), extraBuildArgs: extraBuildArgs, testCommand: testCommand)
28+
return try buildController.buildExecutable(projectFolder: projectFolder, buildType: buildType, clean: true, outputLocation: nil, extraBuildArgs: extraBuildArgs, testCommand: testCommand)
2929
}
3030
}

Tests/nnexTests/IntegrationTests/BuildTests/BuildExecutableTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ extension BuildTests {
114114
#expect(!shell.executedCommand(containing: "cp"))
115115
}
116116

117-
@Test("Builds to desktop when selected", .disabled()) // TODO: -
117+
@Test("Builds to desktop when selected")
118118
func buildsToDesktopWhenSelected() throws {
119119
let armSha256 = "arm123def456"
120120
let intelSha256 = "intel123def456"
@@ -130,7 +130,7 @@ extension BuildTests {
130130
#expect(shell.executedCommand(containing: "Desktop"))
131131
}
132132

133-
@Test("Prompts for custom location and confirms path", .disabled()) // TODO: -
133+
@Test("Prompts for custom location and confirms path")
134134
func promptsForCustomLocationAndConfirmsPath() throws {
135135
let armSha256 = "arm123def456"
136136
let intelSha256 = "intel123def456"
@@ -176,7 +176,7 @@ extension BuildTests {
176176
} catch { }
177177
}
178178

179-
@Test("Copies binary to selected output location", .disabled()) // TODO: -
179+
@Test("Copies binary to selected output location")
180180
func copiesBinaryToSelectedOutputLocation() throws {
181181
let armSha256 = "arm123def456"
182182
let intelSha256 = "intel123def456"

Tests/nnexTests/UnitTests/BuildControllerTests.swift

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -55,47 +55,16 @@ extension BuildControllerTests {
5555
func selectsCurrentDirectoryAsOutput() throws {
5656
let projectDirectory = try makeProjectDirectory(path: "/project/app", executableNames: ["app"])
5757
let (sut, service, _) = makeSUT(projectDirectory: projectDirectory, selectedIndex: 0)
58-
58+
5959
try sut.buildExecutable(path: nil, buildType: .x86_64, clean: true, openInFinder: false)
60-
60+
6161
let buildData = try #require(service.buildData)
6262
if case .currentDirectory(let buildType) = buildData.outputLocation {
6363
#expect(buildType == .x86_64)
6464
} else {
6565
Issue.record("Expected currentDirectory output location")
6666
}
6767
}
68-
69-
@Test("Selects desktop as output location")
70-
func selectsDesktopAsOutput() throws {
71-
let projectDirectory = try makeProjectDirectory(path: "/project/app", executableNames: ["app"])
72-
let (sut, service, _) = makeSUT(projectDirectory: projectDirectory, selectedIndex: 1)
73-
74-
try sut.buildExecutable(path: nil, buildType: .universal, clean: true, openInFinder: false)
75-
76-
let buildData = try #require(service.buildData)
77-
if case .desktop = buildData.outputLocation {
78-
// Success
79-
} else {
80-
Issue.record("Expected desktop output location")
81-
}
82-
}
83-
84-
@Test("Handles custom output location with folder browser", .disabled()) // TODO: -
85-
func handlesCustomOutputLocation() throws {
86-
let projectDirectory = try makeProjectDirectory(path: "/project/app", executableNames: ["app"])
87-
let customFolder = MockDirectory(path: "/custom/location")
88-
let (sut, service, _) = makeSUT(projectDirectory: projectDirectory, selectedIndex: 2, permissionResponses: [true], browsedDirectory: customFolder)
89-
90-
try sut.buildExecutable(path: nil, buildType: .universal, clean: true, openInFinder: false)
91-
92-
let buildData = try #require(service.buildData)
93-
if case .custom(let path) = buildData.outputLocation {
94-
#expect(path == "/custom/location")
95-
} else {
96-
Issue.record("Expected custom output location")
97-
}
98-
}
9968
}
10069

10170

0 commit comments

Comments
 (0)