-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resort to fallback URL when package can't be found
- Loading branch information
1 parent
0b40fce
commit 57a0b21
Showing
2 changed files
with
14 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,7 +132,7 @@ class API_PackageController_GetRoute_ModelTests: SnapshotTestCase { | |
.save(on: app.db) | ||
|
||
// MUT | ||
let forkedFrom = await API.PackageController.GetRoute.Model.ForkedFromInfo.query(on: app.db, packageId: .id0) | ||
let forkedFrom = await API.PackageController.GetRoute.Model.ForkedFromInfo.query(on: app.db, packageId: .id0, fallbackURL: "https://github.com/original/original.git") | ||
|
||
// validate | ||
XCTAssertEqual(forkedFrom, .fromSPI(originalOwner: "original", | ||
|
@@ -141,6 +141,15 @@ class API_PackageController_GetRoute_ModelTests: SnapshotTestCase { | |
originalPackageName: "OriginalPkg")) | ||
} | ||
|
||
func test_ForkedFromInfo_query_fallback() async throws { | ||
// when the package can't be found resort to fallback URL | ||
// MUT | ||
let forkedFrom = await API.PackageController.GetRoute.Model.ForkedFromInfo.query(on: app.db, packageId: .id0, fallbackURL: "https://github.com/original/original.git") | ||
|
||
// validate | ||
XCTAssertEqual(forkedFrom, .fromGitHub(url: "https://github.original/original.git")) | ||
Check failure on line 150 in Tests/AppTests/API+PackageController+GetRoute+ModelTests.swift GitHub Actions / Test
|
||
} | ||
|
||
func test_gitHubOwnerUrl() throws { | ||
var model = API.PackageController.GetRoute.Model.mock | ||
model.repositoryOwner = "owner" | ||
|