Skip to content

Commit

Permalink
Add dedicated mock response for test_decode_multiple_manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
finestructure committed Jun 7, 2024
1 parent 3d4520a commit d08bc45
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
{
"url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/b263042f912ec32a770d2ba254bb6a8c2a49122a",
"path" : "Package@swift-6.swift",
"path" : "Package@swift-5.swift",
"size" : 1517,
"type" : "blob",
"mode" : "100644",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"tree" : [
{
"url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/024f01f8183865bd26e15a7828b0d3a33028d5c5",
"path" : ".gitignore",
"sha" : "024f01f8183865bd26e15a7828b0d3a33028d5c5",
"size" : 290,
"type" : "blob",
"mode" : "100644"
},
{
"path" : ".swift-version",
"type" : "blob",
"mode" : "100644",
"sha" : "6b244dcd6960b101b0ab4d9e5162d39632dec80c",
"url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/6b244dcd6960b101b0ab4d9e5162d39632dec80c",
"size" : 6
},
{
"type" : "blob",
"path" : ".travis.yml",
"mode" : "100644",
"url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/70e2b4cdfc5b7e26d7f55d97833f96aeb7d5c481",
"size" : 1697,
"sha" : "70e2b4cdfc5b7e26d7f55d97833f96aeb7d5c481"
},
{
"sha" : "a7af196875ec68b64f30963189392f71ab9ecf79",
"type" : "blob",
"mode" : "100644",
"size" : 1075,
"url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/a7af196875ec68b64f30963189392f71ab9ecf79",
"path" : "LICENSE"
},
{
"url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/e0570d6a1e3f5b1b4bd213315d8f0966ca8f675f",
"path" : "Package.pins",
"mode" : "100644",
"type" : "blob",
"size" : 53,
"sha" : "e0570d6a1e3f5b1b4bd213315d8f0966ca8f675f"
},
{
"path" : "Package.swift",
"mode" : "100644",
"size" : 825,
"type" : "blob",
"sha" : "63080bd3c929a37b0c8d0796b5d08e51794c18c2",
"url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/63080bd3c929a37b0c8d0796b5d08e51794c18c2"
},
{
"type" : "blob",
"path" : "[email protected]",
"url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/7bd26320357525801b4607dcf78bfeab4ece8508",
"sha" : "7bd26320357525801b4607dcf78bfeab4ece8508",
"size" : 1517,
"mode" : "100644"
},
{
"path" : "[email protected]",
"type" : "blob",
"sha" : "17d053009476faba4f7832d8fb0f408d6cf94ffa",
"mode" : "100644",
"size" : 1517,
"url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/17d053009476faba4f7832d8fb0f408d6cf94ffa"
},
{
"url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/b263042f912ec32a770d2ba254bb6a8c2a49122a",
"path" : "[email protected]",
"size" : 1517,
"type" : "blob",
"mode" : "100644",
"sha" : "b263042f912ec32a770d2ba254bb6a8c2a49122a"
},
{
"url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/4003b2930a1f8488067c543810d02e6fa2c7c949",
"type" : "blob",
"size" : 8861,
"mode" : "100644",
"path" : "README.md",
"sha" : "4003b2930a1f8488067c543810d02e6fa2c7c949"
},
{
"mode" : "040000",
"sha" : "4134f985c3bf0d4fc7029a127fa5082f2a7755a3",
"url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/trees\/4134f985c3bf0d4fc7029a127fa5082f2a7755a3",
"type" : "tree",
"path" : "Sources"
},
{
"type" : "tree",
"sha" : "02fff52637912ccbcbbbbf2aa469de994c8b3441",
"path" : "Tests",
"mode" : "040000",
"url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/trees\/02fff52637912ccbcbbbbf2aa469de994c8b3441"
}
],
"sha" : "f9b4754017cfad4701f0838b2e507b442eaca70a",
"url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/trees\/f9b4754017cfad4701f0838b2e507b442eaca70a",
"truncated" : false
}
9 changes: 4 additions & 5 deletions Tests/ValidatorTests/PackageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ final class PackageTests: XCTestCase {

func test_decode_multiple_manifests() async throws {
// This tests package dump for a package with four versioned package manifest files.
// We use a captured response for the SwiftyJSON package which lists four manifest files
// and then save no data for three of them that shouldn't be used and mock in the
// SemanticVersion manifest files for the one that should be decoded.
// We use a captured response for a package which lists four manifest files.
// For three of them that shouldn't be used we send no data when they are fetched.
// We mock in the SemanticVersion manifest file for the one that should be decoded.
// setup
Current = .mock
Current.fileManager = .live
Expand All @@ -51,8 +51,7 @@ final class PackageTests: XCTestCase {
case "https://api.github.com/repos/org/1/git/trees/main":
// getManifestURLs -> Github.listRepositoryFilePaths -> Github.fetch
return client.eventLoopGroup.next().makeSucceededFuture(
// github-files-response-SwiftyJSON has multiple manifest files
try! .fixture(for: "github-files-response-SwiftyJSON.json")
try! .fixture(for: "github-files-response-multiple-manifests.json")
)
default:
return client.eventLoopGroup.next().makeFailedFuture(
Expand Down

0 comments on commit d08bc45

Please sign in to comment.