Skip to content

Commit 6a6a79a

Browse files
committed
Fix warning, tidy up test
1 parent 63b0ed4 commit 6a6a79a

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

Sources/App/Commands/Ingest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func ingest(client: Client,
125125
s3Readme = .error("\(error)")
126126
}
127127

128-
let fork: Fork? = try? await getFork(on: database, parent: metadata.repository?.parent)
128+
let fork = await getFork(on: database, parent: metadata.repository?.parent)
129129

130130
try await updateRepository(on: database,
131131
for: repo,

Tests/AppTests/IngestorTests.swift

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -604,31 +604,24 @@ class IngestorTests: AppTestCase {
604604
try await Package(id: .id0, url: "https://github.com/foo/parent.git".url, processingStage: .analysis).save(on: app.db)
605605
try await Package(url: "https://github.com/bar/forked.git", processingStage: .analysis).save(on: app.db)
606606

607-
var parent: Github.Metadata.Parent?
608-
609607
// test lookup when package is in the index
610-
parent = .init(url: "https://github.com/foo/parent.git")
611-
let fork = await getFork(on: app.db, parent: parent)
608+
let fork = await getFork(on: app.db, parent: .init(url: "https://github.com/foo/parent.git"))
612609
XCTAssertEqual(fork, .parentId(.id0))
613610

614611
// test lookup when package is in the index but with different case in URL
615-
parent = .init(url: "https://github.com/Foo/Parent.git")
616-
let fork2 = await getFork(on: app.db, parent: parent)
612+
let fork2 = await getFork(on: app.db, parent: .init(url: "https://github.com/Foo/Parent.git"))
617613
XCTAssertEqual(fork2, .parentId(.id0))
618614

619615
// test whem metadata repo url doesn't have `.git` at end
620-
parent = .init(url: "https://github.com/Foo/Parent")
621-
let fork3 = await getFork(on: app.db, parent: parent)
616+
let fork3 = await getFork(on: app.db, parent: .init(url: "https://github.com/Foo/Parent"))
622617
XCTAssertEqual(fork3, .parentId(.id0))
623618

624619
// test lookup when package is not in the index
625-
parent = .init(url: "https://github.com/some/other.git")
626-
let fork4 = await getFork(on: app.db, parent: parent)
620+
let fork4 = await getFork(on: app.db, parent: .init(url: "https://github.com/some/other.git"))
627621
XCTAssertEqual(fork4, .parentURL("https://github.com/some/other.git"))
628622

629623
// test lookup when parent url is nil
630-
parent = nil
631-
let fork5 = await getFork(on: app.db, parent: parent)
624+
let fork5 = await getFork(on: app.db, parent: nil)
632625
XCTAssertEqual(fork5, nil)
633626
}
634627
}

0 commit comments

Comments
 (0)