Skip to content

Commit

Permalink
Fix test_issue_588
Browse files Browse the repository at this point in the history
  • Loading branch information
finestructure committed Jan 24, 2025
1 parent a7828b8 commit 078c517
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions Tests/AppTests/GitlabBuilderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,23 @@ class GitlabBuilderTests: AppTestCase {
}

func test_issue_588() async throws {
let called = QueueIsolated(false)
try await withDependencies {
$0.environment.awsDocsBucket = { "docs-bucket" }
$0.environment.builderToken = { "builder token" }
$0.environment.buildTimeout = { 10 }
$0.environment.gitlabPipelineToken = { "pipeline token" }
$0.environment.siteURL = { "http://example.com" }
} operation: {
var called = false
let client = MockClient { req, res in
called = true
try? res.content.encode(
Gitlab.Builder.Response.init(webUrl: "http://web_url")
)
$0.httpClient.post = { @Sendable _, _, body in
called.setTrue()
let body = try XCTUnwrap(body)
// validate
let swiftVersion = (try? req.query.decode(Gitlab.Builder.PostDTO.self))
let swiftVersion = (try? JSONDecoder().decode(Gitlab.Builder.PostDTO.self, from: body))
.flatMap { $0.variables["SWIFT_VERSION"] }
XCTAssertEqual(swiftVersion, "6.0")
return try .created(jsonEncode: Gitlab.Builder.Response.init(webUrl: "http://web_url"))
}

} operation: {
// MUT
_ = try await Gitlab.Builder.triggerBuild(buildId: .id0,
cloneURL: "https://github.com/daveverwer/LeftPad.git",
Expand All @@ -126,7 +124,7 @@ class GitlabBuilderTests: AppTestCase {
reference: .tag(.init(1, 2, 3)),
swiftVersion: .v6_0,
versionID: .id1)
XCTAssertTrue(called)
XCTAssertTrue(called.value)
}
}

Expand Down

0 comments on commit 078c517

Please sign in to comment.