Skip to content

Commit

Permalink
Fixed up some tests and comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
daveverwer committed Jul 4, 2023
1 parent a37a176 commit 6901306
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Sources/App/Controllers/PackageController+routes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ enum PackageController {
.map { "\(baseUrl)/\(reference)\($0.path)" }
} catch {
// Errors here should *never* break the site map. Instead, they should return no
// linkable entities. The most likely cause of an error here is either a 4xx from
// the `awsResponse` (meaning there is no `linkable-entites.json` on the server),
// linkable paths. The most likely cause of an error here is either a 4xx from
// the `awsResponse` (meaning there is no `linkable-paths.json` on the server),
// or a JSON decoding error. Both should result in a blank set of URLs.
return []
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/AppTests/PackageController+routesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -727,10 +727,10 @@ class PackageController_routesTests: AppTestCase {
}

// MUT
try app.test(.GET, "/owner/package/1.2.3/linkable-entities.json") {
try app.test(.GET, "/owner/package/1.2.3/linkable-paths.json") {
XCTAssertEqual($0.status, .ok)
XCTAssertEqual($0.content.contentType?.description, "application/json")
XCTAssertEqual($0.body.asString(), "/owner/package/1.2.3/linkable-entities.json")
XCTAssertEqual($0.body.asString(), "/owner/package/1.2.3/linkable-paths.json")
}
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/AppTests/SitemapTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class SitemapTests: SnapshotTestCase {
.query(on: app.db, owner: "owner", repository: "repo0")
Current.siteURL = { "https://spi.com" }
Current.fetchDocumentation = { client, url in
guard url.path.hasSuffix("/owner/repo0/default/linkable-entities.json") else { throw Abort(.notFound) }
guard url.path.hasSuffix("/owner/repo0/default/linkable-paths.json") else { throw Abort(.notFound) }
return .init(status: .ok,
body: .init(string: """
[
Expand Down

0 comments on commit 6901306

Please sign in to comment.