Skip to content

Commit

Permalink
Tested ingestion with fetchFunding.
Browse files Browse the repository at this point in the history
  • Loading branch information
daveverwer committed Nov 13, 2023
1 parent 35c0966 commit 918dc8d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Tests/AppTests/IngestorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,22 @@ class IngestorTests: AppTestCase {
}
}

func test_ingest_storeFunding() async throws {
// Setup
let pkg = Package(url: "https://github.com/foo/bar".url, processingStage: .reconciliation)
try await pkg.save(on: app.db)

Current.fetchFunding = { _, _ in .mock }

// MUT
try await ingest(client: app.client, database: app.db, logger: app.logger, mode: .limit(1))

// Validation
try await XCTAssertEqualAsync(await Repository.query(on: app.db).count(), 1)
let repo = try await XCTUnwrapAsync(await Repository.query(on: app.db).first())
XCTAssertEqual(repo.funding, .init(customUrls: ["example.com/funding/link"], github: ["GitHubUsername"]))
}

func test_issue_761_no_license() async throws {
// https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/761
// setup
Expand Down
4 changes: 4 additions & 0 deletions Tests/AppTests/Mocks/GithubMetadata+mock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,7 @@ extension Github.Metadata {
)
}
}

extension Github.Funding {
static let mock: Self = .init(customUrls: ["example.com/funding/link"], github: ["GitHubUsername"])
}

0 comments on commit 918dc8d

Please sign in to comment.