diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6b1d7ee..689039b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: name: macOS runs-on: macOS-13 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # - name: Setup tmate session # uses: mxschmitt/action-tmate@v2 - name: LFS pull @@ -29,8 +29,8 @@ jobs: run: brew link postgresql@15 - name: Start Postgres run: brew services start postgresql@15 - - name: Select Xcode 15.1 - run: sudo xcode-select -s /Applications/Xcode_15.1.app + - name: Select Xcode 15.2 + run: sudo xcode-select -s /Applications/Xcode_15.2.app - name: Bootstrap run: make bootstrap - name: Run tests @@ -40,7 +40,7 @@ jobs: name: Ubuntu runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: 'sudo apt-get --fix-missing update && sudo apt-get install -y wamerican' - name: Bootstrap diff --git a/App/isowords.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/App/isowords.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index c47b9f8e..cae75f33 100644 --- a/App/isowords.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/App/isowords.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -113,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-composable-architecture", "state" : { - "revision" : "3568f01377c6c668aad40d066acf97ce670a1dad", - "version" : "1.5.6" + "revision" : "ae491c9e3f66631e72d58db8bb4c27dfc3d3afd4", + "version" : "1.6.0" } }, { diff --git a/Makefile b/Makefile index de5b2cd4..4fd203fc 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ else @git lfs pull endif -PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS 17,iPhone \d\+ Pro [^M]) +PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS 17.2,iPhone \d\+ Pro [^M]) test-client: @xcodebuild test \ -project App/isowords.xcodeproj \ diff --git a/Package.swift b/Package.swift index 437e65ac..4d0dae36 100644 --- a/Package.swift +++ b/Package.swift @@ -93,6 +93,7 @@ var package = Package( "SiteMiddleware", .product(name: "HttpPipeline", package: "swift-web"), .product(name: "HttpPipelineTestSupport", package: "swift-web"), + .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), .product(name: "Prelude", package: "swift-prelude"), .product(name: "SnapshotTesting", package: "swift-snapshot-testing"), ], @@ -158,6 +159,7 @@ var package = Package( "FirstPartyMocks", "SharedModels", "TestHelpers", + .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), .product(name: "Overture", package: "swift-overture"), .product(name: "SnapshotTesting", package: "swift-snapshot-testing"), ], @@ -396,6 +398,7 @@ if ProcessInfo.processInfo.environment["TEST_SERVER"] == nil { "FirstPartyMocks", "TestHelpers", .product(name: "CustomDump", package: "swift-custom-dump"), + .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), .product(name: "Overture", package: "swift-overture"), .product(name: "SnapshotTesting", package: "swift-snapshot-testing"), ], @@ -1027,6 +1030,7 @@ package.targets.append(contentsOf: [ "AppSiteAssociationMiddleware", "SiteMiddleware", .product(name: "HttpPipelineTestSupport", package: "swift-web"), + .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), .product(name: "SnapshotTesting", package: "swift-snapshot-testing"), ] ), @@ -1055,6 +1059,7 @@ package.targets.append(contentsOf: [ .product(name: "CustomDump", package: "swift-custom-dump"), .product(name: "HttpPipeline", package: "swift-web"), .product(name: "HttpPipelineTestSupport", package: "swift-web"), + .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), .product(name: "SnapshotTesting", package: "swift-snapshot-testing"), ], exclude: ["__Snapshots__"] @@ -1118,6 +1123,7 @@ package.targets.append(contentsOf: [ "DemoMiddleware", "SiteMiddleware", .product(name: "HttpPipelineTestSupport", package: "swift-web"), + .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), .product(name: "SnapshotTesting", package: "swift-snapshot-testing"), ] ), @@ -1146,6 +1152,7 @@ package.targets.append(contentsOf: [ "SiteMiddleware", .product(name: "CustomDump", package: "swift-custom-dump"), .product(name: "HttpPipelineTestSupport", package: "swift-web"), + .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), .product(name: "SnapshotTesting", package: "swift-snapshot-testing"), ], exclude: ["__Snapshots__"] @@ -1190,6 +1197,7 @@ package.targets.append(contentsOf: [ .product(name: "Either", package: "swift-prelude"), .product(name: "HttpPipeline", package: "swift-web"), .product(name: "HttpPipelineTestSupport", package: "swift-web"), + .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), .product(name: "Overture", package: "swift-overture"), .product(name: "Prelude", package: "swift-prelude"), .product(name: "SnapshotTesting", package: "swift-snapshot-testing"), @@ -1244,13 +1252,6 @@ package.targets.append(contentsOf: [ .product(name: "HttpPipeline", package: "swift-web"), ] ), - .target( - name: "ServerTestHelpers", - dependencies: [ - .product(name: "Either", package: "swift-prelude"), - .product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay"), - ] - ), .testTarget( name: "ServerConfigMiddlewareTests", dependencies: [ @@ -1259,9 +1260,17 @@ package.targets.append(contentsOf: [ .product(name: "Either", package: "swift-prelude"), .product(name: "HttpPipeline", package: "swift-web"), .product(name: "HttpPipelineTestSupport", package: "swift-web"), + .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), .product(name: "Prelude", package: "swift-prelude"), ] ), + .target( + name: "ServerTestHelpers", + dependencies: [ + .product(name: "Either", package: "swift-prelude"), + .product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay"), + ] + ), .target( name: "ShareGameMiddleware", dependencies: [ @@ -1280,6 +1289,7 @@ package.targets.append(contentsOf: [ "SiteMiddleware", "TestHelpers", .product(name: "HttpPipelineTestSupport", package: "swift-web"), + .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), .product(name: "SnapshotTesting", package: "swift-snapshot-testing"), ], exclude: ["__Snapshots__"] @@ -1315,6 +1325,7 @@ package.targets.append(contentsOf: [ "SiteMiddleware", "TestHelpers", .product(name: "HttpPipelineTestSupport", package: "swift-web"), + .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), .product(name: "SnapshotTesting", package: "swift-snapshot-testing"), ], exclude: ["__Snapshots__"] @@ -1332,6 +1343,7 @@ package.targets.append(contentsOf: [ name: "SnsClientTests", dependencies: [ "SnsClient", + .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), .product(name: "SnapshotTesting", package: "swift-snapshot-testing"), ] ), @@ -1361,6 +1373,7 @@ package.targets.append(contentsOf: [ "SiteMiddleware", .product(name: "CustomDump", package: "swift-custom-dump"), .product(name: "HttpPipelineTestSupport", package: "swift-web"), + .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), .product(name: "SnapshotTesting", package: "swift-snapshot-testing"), ] ), diff --git a/Tests/AppSiteAssociationMiddlewareTests/AppSiteAssociationMiddlewareTests.swift b/Tests/AppSiteAssociationMiddlewareTests/AppSiteAssociationMiddlewareTests.swift index eab0c2df..85d54be6 100644 --- a/Tests/AppSiteAssociationMiddlewareTests/AppSiteAssociationMiddlewareTests.swift +++ b/Tests/AppSiteAssociationMiddlewareTests/AppSiteAssociationMiddlewareTests.swift @@ -1,24 +1,26 @@ import AppSiteAssociationMiddleware import Foundation -#if canImport(FoundationNetworking) - import FoundationNetworking -#endif import HttpPipeline import HttpPipelineTestSupport +import InlineSnapshotTesting import Prelude import ServerRouter import SharedModels import SiteMiddleware -import SnapshotTesting import XCTest +#if canImport(FoundationNetworking) + import FoundationNetworking +#endif + class AppSiteAssociationMiddlewareTests: XCTestCase { func testBasics() throws { let request = URLRequest(url: URL(string: "/.well-known/apple-app-site-association")!) let middleware = siteMiddleware(environment: .testValue) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: #""" + assertInlineSnapshot(of: result, as: .conn) { + #""" GET /.well-known/apple-app-site-association 200 OK @@ -54,6 +56,8 @@ class AppSiteAssociationMiddlewareTests: XCTestCase { ] } } - """#) + + """# + } } } diff --git a/Tests/DailyChallengeMiddlewareTests/DailyChallengeMiddlewareTests.swift b/Tests/DailyChallengeMiddlewareTests/DailyChallengeMiddlewareTests.swift index 53c379e9..0b39d233 100644 --- a/Tests/DailyChallengeMiddlewareTests/DailyChallengeMiddlewareTests.swift +++ b/Tests/DailyChallengeMiddlewareTests/DailyChallengeMiddlewareTests.swift @@ -1,21 +1,22 @@ import CustomDump import DatabaseClient import Either -import Foundation -#if canImport(FoundationNetworking) - import FoundationNetworking -#endif import FirstPartyMocks +import Foundation import HttpPipeline import HttpPipelineTestSupport +import InlineSnapshotTesting import MailgunClient import Overture import SharedModels -import SnapshotTesting import XCTest @testable import SiteMiddleware +#if canImport(FoundationNetworking) + import FoundationNetworking +#endif + class DailyChallengeMiddlewareTests: XCTestCase { let encoder = update(JSONEncoder()) { $0.dateEncodingStrategy = .secondsSince1970 @@ -24,7 +25,7 @@ class DailyChallengeMiddlewareTests: XCTestCase { override func setUp() { super.setUp() -// SnapshotTesting.isRecording=true + // SnapshotTesting.isRecording=true } func testToday_NotYetPlayed() { @@ -178,10 +179,8 @@ class DailyChallengeMiddlewareTests: XCTestCase { ) ) request.allHTTPHeaderFields = [ - "X-Signature": ( - request.httpBody! + Data("----SECRET_DEADBEEF----1234567890".utf8) - ) - .base64EncodedString() + "X-Signature": (request.httpBody! + Data("----SECRET_DEADBEEF----1234567890".utf8)) + .base64EncodedString() ] var environment = ServerEnvironment.testValue @@ -237,7 +236,8 @@ class DailyChallengeMiddlewareTests: XCTestCase { let middleware = siteMiddleware(environment: environment) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ POST /api/games?accessToken=deadbeef-dead-beef-dead-beefdeadbeef×tamp=1234567890 X-Signature: ewogICJnYW1lQ29udGV4dCIgOiB7CiAgICAiZGFpbHlDaGFsbGVuZ2VJZCIgOiAiREVBREJFRUYtREVBRC1CRUVGLURFQUQtREExMTdDNEExMTMyIgogIH0sCiAgIm1vdmVzIiA6IFsKICAgIHsKICAgICAgInBsYXllZEF0IiA6IDEyMzQ1Njc4OTAuNSwKICAgICAgInNjb3JlIiA6IDI3LAogICAgICAidHlwZSIgOiB7CiAgICAgICAgInBsYXllZFdvcmQiIDogWwogICAgICAgICAgewogICAgICAgICAgICAiaW5kZXgiIDogewogICAgICAgICAgICAgICJ4IiA6IDIsCiAgICAgICAgICAgICAgInkiIDogMiwKICAgICAgICAgICAgICAieiIgOiAyCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICJzaWRlIiA6IDAKICAgICAgICAgIH0sCiAgICAgICAgICB7CiAgICAgICAgICAgICJpbmRleCIgOiB7CiAgICAgICAgICAgICAgIngiIDogMiwKICAgICAgICAgICAgICAieSIgOiAyLAogICAgICAgICAgICAgICJ6IiA6IDIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgInNpZGUiIDogMQogICAgICAgICAgfSwKICAgICAgICAgIHsKICAgICAgICAgICAgImluZGV4IiA6IHsKICAgICAgICAgICAgICAieCIgOiAyLAogICAgICAgICAgICAgICJ5IiA6IDIsCiAgICAgICAgICAgICAgInoiIDogMgogICAgICAgICAgICB9LAogICAgICAgICAgICAic2lkZSIgOiAyCiAgICAgICAgICB9CiAgICAgICAgXQogICAgICB9CiAgICB9CiAgXQp9LS0tLVNFQ1JFVF9ERUFEQkVFRi0tLS0xMjM0NTY3ODkw @@ -280,7 +280,7 @@ class DailyChallengeMiddlewareTests: XCTestCase { } ] } - + 200 OK Content-Length: 107 Content-Type: application/json @@ -290,7 +290,7 @@ class DailyChallengeMiddlewareTests: XCTestCase { X-Frame-Options: SAMEORIGIN X-Permitted-Cross-Domain-Policies: none X-XSS-Protection: 1; mode=block - + { "dailyChallenge" : { "outOf" : 100, @@ -299,8 +299,9 @@ class DailyChallengeMiddlewareTests: XCTestCase { "started" : false } } + """ - ) + } XCTAssertNoDifference( submittedScore, @@ -352,10 +353,8 @@ class DailyChallengeMiddlewareTests: XCTestCase { ) ) request.allHTTPHeaderFields = [ - "X-Signature": ( - request.httpBody! + Data("----SECRET_DEADBEEF----1234567890".utf8) - ) - .base64EncodedString() + "X-Signature": (request.httpBody! + Data("----SECRET_DEADBEEF----1234567890".utf8)) + .base64EncodedString() ] var environment = ServerEnvironment.testValue @@ -382,10 +381,11 @@ class DailyChallengeMiddlewareTests: XCTestCase { // NB: Linux's localized message is different #if !os(Linux) - _assertInlineSnapshot(matching: result, as: .conn, with: #""" + assertInlineSnapshot(of: result, as: .conn) { + #""" POST /api/games?accessToken=deadbeef-dead-beef-dead-beefdeadbeef×tamp=1234567890 X-Signature: ewogICJnYW1lQ29udGV4dCIgOiB7CiAgICAiZGFpbHlDaGFsbGVuZ2VJZCIgOiAiREVBREJFRUYtREVBRC1CRUVGLURFQUQtREExMTdDNEExMTMyIgogIH0sCiAgIm1vdmVzIiA6IFsKICAgIHsKICAgICAgInBsYXllZEF0IiA6IDEyMzQ1Njc4OTAsCiAgICAgICJzY29yZSIgOiAxMDAwLAogICAgICAidHlwZSIgOiB7CiAgICAgICAgInBsYXllZFdvcmQiIDogWwogICAgICAgICAgewogICAgICAgICAgICAiaW5kZXgiIDogewogICAgICAgICAgICAgICJ4IiA6IDAsCiAgICAgICAgICAgICAgInkiIDogMCwKICAgICAgICAgICAgICAieiIgOiAwCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICJzaWRlIiA6IDEKICAgICAgICAgIH0sCiAgICAgICAgICB7CiAgICAgICAgICAgICJpbmRleCIgOiB7CiAgICAgICAgICAgICAgIngiIDogMCwKICAgICAgICAgICAgICAieSIgOiAwLAogICAgICAgICAgICAgICJ6IiA6IDAKICAgICAgICAgICAgfSwKICAgICAgICAgICAgInNpZGUiIDogMgogICAgICAgICAgfSwKICAgICAgICAgIHsKICAgICAgICAgICAgImluZGV4IiA6IHsKICAgICAgICAgICAgICAieCIgOiAxLAogICAgICAgICAgICAgICJ5IiA6IDAsCiAgICAgICAgICAgICAgInoiIDogMAogICAgICAgICAgICB9LAogICAgICAgICAgICAic2lkZSIgOiAyCiAgICAgICAgICB9CiAgICAgICAgXQogICAgICB9CiAgICB9CiAgXQp9LS0tLVNFQ1JFVF9ERUFEQkVFRi0tLS0xMjM0NTY3ODkw - + { "gameContext" : { "dailyChallengeId" : "DEADBEEF-DEAD-BEEF-DEAD-DA117C4A1132" @@ -425,7 +425,7 @@ class DailyChallengeMiddlewareTests: XCTestCase { } ] } - + 400 Bad Request Content-Length: 492 Content-Type: application/json @@ -435,15 +435,16 @@ class DailyChallengeMiddlewareTests: XCTestCase { X-Frame-Options: SAMEORIGIN X-Permitted-Cross-Domain-Policies: none X-XSS-Protection: 1; mode=block - + { "errorDump" : "▿ SharedModels.ApiError\n - errorDump: \"- LeaderboardMiddleware.VerificationFailed\\n\"\n - file: \"LeaderboardMiddleware\/SubmitGameMiddleware.swift\"\n - line: 109\n - message: \"The operation couldn’t be completed. (LeaderboardMiddleware.VerificationFailed error 1.)\"\n", "file" : "LeaderboardMiddleware\/SubmitGameMiddleware.swift", "line" : 202, "message" : "The operation couldn’t be completed. (LeaderboardMiddleware.VerificationFailed error 1.)" } + """# - ) + } #endif } @@ -488,9 +489,10 @@ class DailyChallengeMiddlewareTests: XCTestCase { let middleware = siteMiddleware(environment: environment) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ GET /api/daily-challenges/results?accessToken=deadbeef-dead-beef-dead-beefdeadbeef&gameMode=unlimited&language=en - + 200 OK Content-Length: 471 Content-Type: application/json @@ -500,7 +502,7 @@ class DailyChallengeMiddlewareTests: XCTestCase { X-Frame-Options: SAMEORIGIN X-Permitted-Cross-Domain-Policies: none X-XSS-Protection: 1; mode=block - + { "results" : [ { @@ -523,7 +525,8 @@ class DailyChallengeMiddlewareTests: XCTestCase { } ] } + """ - ) + } } } diff --git a/Tests/DemoMiddlewareTests/DemoMiddlewareTests.swift b/Tests/DemoMiddlewareTests/DemoMiddlewareTests.swift index d654cebc..f4898ba9 100644 --- a/Tests/DemoMiddlewareTests/DemoMiddlewareTests.swift +++ b/Tests/DemoMiddlewareTests/DemoMiddlewareTests.swift @@ -7,12 +7,12 @@ import Foundation #endif import HttpPipeline import HttpPipelineTestSupport +import InlineSnapshotTesting import Overture import Prelude import ServerRouter import SharedModels import SiteMiddleware -import SnapshotTesting import XCTest class DemoMiddlewareTests: XCTestCase { @@ -41,7 +41,8 @@ class DemoMiddlewareTests: XCTestCase { let middleware = siteMiddleware(environment: environment) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ POST /demo/games {"gameMode": "timed", "score": 1000} @@ -72,7 +73,8 @@ class DemoMiddlewareTests: XCTestCase { } } } + """ - ) + } } } diff --git a/Tests/LeaderboardMiddlewareTests/LeaderboardMiddlewareTests.swift b/Tests/LeaderboardMiddlewareTests/LeaderboardMiddlewareTests.swift index 9f115abd..4a89c451 100644 --- a/Tests/LeaderboardMiddlewareTests/LeaderboardMiddlewareTests.swift +++ b/Tests/LeaderboardMiddlewareTests/LeaderboardMiddlewareTests.swift @@ -3,20 +3,21 @@ import DatabaseClient import Either import EnvVars import Foundation -#if canImport(FoundationNetworking) - import FoundationNetworking -#endif import HttpPipeline import HttpPipelineTestSupport +import InlineSnapshotTesting import Overture import Prelude import ServerRouter import SharedModels -import SnapshotTesting import XCTest @testable import SiteMiddleware +#if canImport(FoundationNetworking) + import FoundationNetworking +#endif + class LeaderboardMiddlewareTests: XCTestCase { func testSubmitLeaderboardScore() { let player = Player.blob @@ -105,7 +106,8 @@ class LeaderboardMiddlewareTests: XCTestCase { let middleware = siteMiddleware(environment: environment) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ POST /api/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iQyIsInNpZGUiOjB9fV0sW3sibGVmdCI6eyJsZXR0ZXIiOiJBIiwic2lkZSI6MX0sInJpZ2h0Ijp7ImxldHRlciI6IkIiLCJzaWRlIjoyfSwidG9wIjp7ImxldHRlciI6IkMiLCJzaWRlIjowfX0seyJsZWZ0Ijp7ImxldHRlciI6IkEiLCJzaWRlIjoxfSwicmlnaHQiOnsibGV0dGVyIjoiQiIsInNpZGUiOjJ9LCJ0b3AiOnsibGV0dGVyIjoiQyIsInNpZGUiOjB9fSx7ImxlZnQiOnsibGV0dGVyIjoiQSIsInNpZGUiOjF9LCJyaWdodCI6eyJsZXR0ZXIiOiJCIiwic2lkZSI6Mn0sInRvcCI6eyJsZXR0ZXIiOiJDIiwic2lkZSI6MH19XV1dfX0sIm1vdmVzIjpbeyJwbGF5ZWRBdCI6MTIzNDU2Nzg5MC41LCJzY29yZSI6MjcsInR5cGUiOnsicGxheWVkV29yZCI6W3siaW5kZXgiOnsieCI6MiwieSI6MiwieiI6Mn0sInNpZGUiOjB9LHsiaW5kZXgiOnsieCI6MiwieSI6MiwieiI6Mn0sInNpZGUiOjF9LHsiaW5kZXgiOnsieCI6MiwieSI6MiwieiI6Mn0sInNpZGUiOjJ9XX19XX0tLS0tU0VDUkVUX0RFQURCRUVGLS0tLTEyMzQ1Njc4OTA= @@ -120,7 +122,7 @@ class LeaderboardMiddlewareTests: XCTestCase { X-Frame-Options: SAMEORIGIN X-Permitted-Cross-Domain-Policies: none X-XSS-Protection: 1; mode=block - + { "solo" : { "ranks" : { @@ -139,8 +141,9 @@ class LeaderboardMiddlewareTests: XCTestCase { } } } + """ - ) + } } func testSubmitLeaderboardScore_DailyChallenge() { @@ -245,7 +248,8 @@ class LeaderboardMiddlewareTests: XCTestCase { let middleware = siteMiddleware(environment: environment) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ POST /api/games?accessToken=deadbeef-dead-beef-dead-beefdeadbeef×tamp=1234567890 X-Signature: eyJnYW1lQ29udGV4dCI6eyJkYWlseUNoYWxsZW5nZUlkIjoiREVBREJFRUYtREVBRC1CRUVGLURFQUQtREExMTdDNEExMTMyIn0sIm1vdmVzIjpbeyJwbGF5ZWRBdCI6MTIzNDU2Nzg5MC41LCJzY29yZSI6MjcsInR5cGUiOnsicGxheWVkV29yZCI6W3siaW5kZXgiOnsieCI6MiwieSI6MiwieiI6Mn0sInNpZGUiOjB9LHsiaW5kZXgiOnsieCI6MiwieSI6MiwieiI6Mn0sInNpZGUiOjF9LHsiaW5kZXgiOnsieCI6MiwieSI6MiwieiI6Mn0sInNpZGUiOjJ9XX19XX0tLS0tU0VDUkVUX0RFQURCRUVGLS0tLTEyMzQ1Njc4OTA= @@ -260,7 +264,7 @@ class LeaderboardMiddlewareTests: XCTestCase { X-Frame-Options: SAMEORIGIN X-Permitted-Cross-Domain-Policies: none X-XSS-Protection: 1; mode=block - + { "dailyChallenge" : { "outOf" : 100, @@ -268,8 +272,9 @@ class LeaderboardMiddlewareTests: XCTestCase { "started" : false } } + """ - ) + } } func testSubmitLeaderboardScore_Shared() { @@ -329,7 +334,8 @@ class LeaderboardMiddlewareTests: XCTestCase { let middleware = siteMiddleware(environment: environment) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ POST /api/games?accessToken=deadbeef-dead-beef-dead-beefdeadbeef×tamp=1234567890 X-Signature: eyJnYW1lQ29udGV4dCI6eyJzaGFyZWRHYW1lQ29kZSI6ImRlYWRiZWVmIn0sIm1vdmVzIjpbeyJwbGF5ZWRBdCI6MTIzNDU2Nzg5MC41LCJzY29yZSI6MTAwLCJ0eXBlIjp7InBsYXllZFdvcmQiOlt7ImluZGV4Ijp7IngiOjIsInkiOjIsInoiOjJ9LCJzaWRlIjoxfSx7ImluZGV4Ijp7IngiOjIsInkiOjIsInoiOjJ9LCJzaWRlIjoyfSx7ImluZGV4Ijp7IngiOjIsInkiOjIsInoiOjJ9LCJzaWRlIjowfV19fV19LS0tLVNFQ1JFVF9ERUFEQkVFRi0tLS0xMjM0NTY3ODkw @@ -760,8 +766,9 @@ class LeaderboardMiddlewareTests: XCTestCase { ] } } + """ - ) + } } func testSubmitLeaderboardScore_TurnBased() { @@ -850,12 +857,13 @@ class LeaderboardMiddlewareTests: XCTestCase { let middleware = siteMiddleware(environment: environment) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ POST /api/games?accessToken=deadbeef-dead-beef-dead-beefdeadbeef×tamp=1234567890 X-Signature: eyJnYW1lQ29udGV4dCI6eyJ0dXJuQmFzZWQiOnsiZ2FtZU1vZGUiOiJ1bmxpbWl0ZWQiLCJsYW5ndWFnZSI6ImVuIiwicGxheWVySW5kZXhUb0lkIjp7IjAiOiJCMTBCQjEwQi1ERUFELUJFRUYtREVBRC1CRUVGREVBREJFRUYiLCIxIjoiQjEwQjIwMDAtREVBRC1CRUVGLURFQUQtQkVFRkRFQURCRUVGIn0sInB1enpsZSI6W1tbeyJsZWZ0Ijp7ImxldHRlciI6IkEiLCJzaWRlIjoxfSwicmlnaHQiOnsibGV0dGVyIjoiQiIsInNpZGUiOjJ9LCJ0b3AiOnsibGV0dGVyIjoiQyIsInNpZGUiOjB9fSx7ImxlZnQiOnsibGV0dGVyIjoiQSIsInNpZGUiOjF9LCJyaWdodCI6eyJsZXR0ZXIiOiJCIiwic2lkZSI6Mn0sInRvcCI6eyJsZXR0ZXIiOiJDIiwic2lkZSI6MH19LHsibGVmdCI6eyJsZXR0ZXIiOiJBIiwic2lkZSI6MX0sInJpZ2h0Ijp7ImxldHRlciI6IkIiLCJzaWRlIjoyfSwidG9wIjp7ImxldHRlciI6IkMiLCJzaWRlIjowfX1dLFt7ImxlZnQiOnsibGV0dGVyIjoiQSIsInNpZGUiOjF9LCJyaWdodCI6eyJsZXR0ZXIiOiJCIiwic2lk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LCJ6IjoyfSwic2lkZSI6Mn0seyJpbmRleCI6eyJ4IjoyLCJ5IjoyLCJ6IjoyfSwic2lkZSI6MH1dfX0seyJwbGF5ZWRBdCI6MTIzNDU2Nzg5MC41LCJwbGF5ZXJJbmRleCI6MCwic2NvcmUiOjI3LCJ0eXBlIjp7InBsYXllZFdvcmQiOlt7ImluZGV4Ijp7IngiOjIsInkiOjIsInoiOjJ9LCJzaWRlIjowfSx7ImluZGV4Ijp7IngiOjIsInkiOjIsInoiOjJ9LCJzaWRlIjoxfSx7ImluZGV4Ijp7IngiOjIsInkiOjIsInoiOjJ9LCJzaWRlIjoyfV19fV19LS0tLVNFQ1JFVF9ERUFEQkVFRi0tLS0xMjM0NTY3ODkw {"gameContext":{"turnBased":{"gameMode":"unlimited","language":"en","playerIndexToId":{"0":"B10BB10B-DEAD-BEEF-DEAD-BEEFDEADBEEF","1":"B10B2000-DEAD-BEEF-DEAD-BEEFDEADBEEF"},"puzzle":[[[{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}}],[{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}}],[{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}}]],[[{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}}],[{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}}],[{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}}]],[[{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}}],[{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}}],[{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}},{"left":{"letter":"A","side":1},"right":{"letter":"B","side":2},"top":{"letter":"C","side":0}}]]]}},"moves":[{"playedAt":1234567890.5,"playerIndex":1,"score":27,"type":{"playedWord":[{"index":{"x":2,"y":2,"z":2},"side":1},{"index":{"x":2,"y":2,"z":2},"side":2},{"index":{"x":2,"y":2,"z":2},"side":0}]}},{"playedAt":1234567890.5,"playerIndex":0,"score":27,"type":{"playedWord":[{"index":{"x":2,"y":2,"z":2},"side":0},{"index":{"x":2,"y":2,"z":2},"side":1},{"index":{"x":2,"y":2,"z":2},"side":2}]}}]} - + 200 OK Content-Length: 24 Content-Type: application/json @@ -865,12 +873,13 @@ class LeaderboardMiddlewareTests: XCTestCase { X-Frame-Options: SAMEORIGIN X-Permitted-Cross-Domain-Policies: none X-XSS-Protection: 1; mode=block - + { "turnBased" : true } + """ - ) + } XCTAssertNoDifference( scores.sorted(by: { $0.playerId == player.id && $1.playerId != player.id }), diff --git a/Tests/PushMiddlewareTests/PushMiddlewareTests.swift b/Tests/PushMiddlewareTests/PushMiddlewareTests.swift index 39ca621b..bcf93989 100644 --- a/Tests/PushMiddlewareTests/PushMiddlewareTests.swift +++ b/Tests/PushMiddlewareTests/PushMiddlewareTests.swift @@ -2,22 +2,23 @@ import CustomDump import DatabaseClient import Either import Foundation -#if canImport(FoundationNetworking) - import FoundationNetworking -#endif import HttpPipeline import HttpPipelineTestSupport +import InlineSnapshotTesting import Overture import Prelude import PushMiddleware import ServerRouter import SharedModels import SiteMiddleware -import SnapshotTesting import XCTest @testable import SnsClient +#if canImport(FoundationNetworking) + import FoundationNetworking +#endif + class PushMiddlewareTests: XCTestCase { func testRegisterToken() throws { var createPlatformRequest: SnsClient.CreatePlatformRequest? @@ -61,7 +62,8 @@ class PushMiddlewareTests: XCTestCase { ) ) - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ POST /api/push-tokens?accessToken=deadbeef-dead-beef-dead-beefdeadbeef {"token":"deadbeef"} @@ -79,8 +81,9 @@ class PushMiddlewareTests: XCTestCase { { } + """ - ) + } } func testRegisterToken_WithBuild() throws { @@ -125,7 +128,8 @@ class PushMiddlewareTests: XCTestCase { ) ) - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ POST /api/push-tokens?accessToken=deadbeef-dead-beef-dead-beefdeadbeef {"build":42,"token":"deadbeef"} @@ -143,8 +147,9 @@ class PushMiddlewareTests: XCTestCase { { } + """ - ) + } } func testRegisterToken_WithBuildAndAuthorizationStatus() throws { @@ -189,7 +194,8 @@ class PushMiddlewareTests: XCTestCase { ) ) - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ POST /api/push-tokens?accessToken=deadbeef-dead-beef-dead-beefdeadbeef {"authorizationStatus":2,"build":42,"token":"deadbeef"} @@ -207,8 +213,9 @@ class PushMiddlewareTests: XCTestCase { { } + """ - ) + } } func testRegisterSandboxToken() throws { @@ -254,7 +261,8 @@ class PushMiddlewareTests: XCTestCase { ) ) - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ POST /api/push-tokens?accessToken=deadbeef-dead-beef-dead-beefdeadbeef X-Debug: true @@ -273,8 +281,9 @@ class PushMiddlewareTests: XCTestCase { { } + """ - ) + } } func testUpdateSetting() throws { @@ -305,7 +314,8 @@ class PushMiddlewareTests: XCTestCase { XCTAssertNoDifference(notificationType, .dailyChallengeEndsSoon) XCTAssertNoDifference(sendNotifications, false) - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ POST /api/push-settings?accessToken=deadbeef-dead-beef-dead-beefdeadbeef {"notificationType":"dailyChallengeEndsSoon","sendNotifications":false} @@ -323,8 +333,9 @@ class PushMiddlewareTests: XCTestCase { { } + """ - ) + } } } diff --git a/Tests/ServerConfigMiddlewareTests/ServerConfigMiddlewareTests.swift b/Tests/ServerConfigMiddlewareTests/ServerConfigMiddlewareTests.swift index 0878e682..903759f3 100644 --- a/Tests/ServerConfigMiddlewareTests/ServerConfigMiddlewareTests.swift +++ b/Tests/ServerConfigMiddlewareTests/ServerConfigMiddlewareTests.swift @@ -1,16 +1,17 @@ import Either import Foundation -#if canImport(FoundationNetworking) - import FoundationNetworking -#endif import HttpPipeline import HttpPipelineTestSupport -import SnapshotTesting +import InlineSnapshotTesting import XCTest @testable import SharedModels @testable import SiteMiddleware +#if canImport(FoundationNetworking) + import FoundationNetworking +#endif + class ServerConfigMiddlewareTests: XCTestCase { override func setUp() { super.setUp() @@ -35,9 +36,10 @@ class ServerConfigMiddlewareTests: XCTestCase { let middleware = siteMiddleware(environment: environment) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ GET /api/config?accessToken=deadbeef-dead-beef-dead-beefdeadbeef&build=42 - + 200 OK Content-Length: 513 Content-Type: application/json @@ -47,7 +49,7 @@ class ServerConfigMiddlewareTests: XCTestCase { X-Frame-Options: SAMEORIGIN X-Permitted-Cross-Domain-Policies: none X-XSS-Protection: 1; mode=block - + { "appId" : "1528246952", "forceUpgradeVersion" : 0, @@ -66,8 +68,9 @@ class ServerConfigMiddlewareTests: XCTestCase { "soloGameTriggerEvery" : 3 } } + """ - ) + } } func testServerConfig_IsBehind() { @@ -89,7 +92,8 @@ class ServerConfigMiddlewareTests: XCTestCase { let middleware = siteMiddleware(environment: environment) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ GET /api/config?accessToken=deadbeef-dead-beef-dead-beefdeadbeef&build=40 200 OK @@ -120,7 +124,8 @@ class ServerConfigMiddlewareTests: XCTestCase { "soloGameTriggerEvery" : 3 } } + """ - ) + } } } diff --git a/Tests/ShareGameMiddlewareTests/ShareGameMiddleware.swift b/Tests/ShareGameMiddlewareTests/ShareGameMiddleware.swift index a7c8d5fd..1542eb03 100644 --- a/Tests/ShareGameMiddlewareTests/ShareGameMiddleware.swift +++ b/Tests/ShareGameMiddlewareTests/ShareGameMiddleware.swift @@ -6,9 +6,9 @@ import Foundation import FirstPartyMocks import HttpPipeline import HttpPipelineTestSupport +import InlineSnapshotTesting import Overture import SharedModels -import SnapshotTesting import TestHelpers import XCTest @@ -64,7 +64,8 @@ class ShareGameMiddlewareTests: XCTestCase { let middleware = siteMiddleware(environment: environment) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ GET /sharedGames/deadbeef 302 Found @@ -76,7 +77,7 @@ class ShareGameMiddlewareTests: XCTestCase { X-Permitted-Cross-Domain-Policies: none X-XSS-Protection: 1; mode=block """ - ) + } } func testFetchSharedGame() throws { diff --git a/Tests/SiteMiddlewareTests/AuthenticationMiddlewareTests.swift b/Tests/SiteMiddlewareTests/AuthenticationMiddlewareTests.swift index 9721480b..d22b5b93 100644 --- a/Tests/SiteMiddlewareTests/AuthenticationMiddlewareTests.swift +++ b/Tests/SiteMiddlewareTests/AuthenticationMiddlewareTests.swift @@ -7,10 +7,10 @@ import Foundation #endif import HttpPipeline import HttpPipelineTestSupport +import InlineSnapshotTesting import Overture import ServerRouter import SharedModels -import SnapshotTesting import XCTest @testable import SiteMiddleware @@ -56,7 +56,8 @@ class AuthenticationMiddlewareTests: XCTestCase { let middleware = siteMiddleware(environment: environment) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: #""" + assertInlineSnapshot(of: result, as: .conn) { + #""" POST /api/authenticate { @@ -111,8 +112,9 @@ class AuthenticationMiddlewareTests: XCTestCase { "timeZone" : "America\/New_York" } } + """# - ) + } } func testRegister_WithInvalidGameCenterId() throws { @@ -150,15 +152,16 @@ class AuthenticationMiddlewareTests: XCTestCase { let middleware = siteMiddleware(environment: environment) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: #""" + assertInlineSnapshot(of: result, as: .conn) { + #""" POST /api/authenticate - + { "deviceId": "de71ce00-dead-beef-dead-beefdeadbeef", "displayName": "Blob", "gameCenterLocalPlayerId": "Unavailable Player Identification" } - + 200 OK Content-Length: 1055 Content-Type: application/json @@ -168,7 +171,7 @@ class AuthenticationMiddlewareTests: XCTestCase { X-Frame-Options: SAMEORIGIN X-Permitted-Cross-Domain-Policies: none X-XSS-Protection: 1; mode=block - + { "appleReceipt" : { "environment" : "Production", @@ -204,7 +207,8 @@ class AuthenticationMiddlewareTests: XCTestCase { "timeZone" : "America\/New_York" } } + """# - ) + } } } diff --git a/Tests/SnsClientTests/SnsClientTests.swift b/Tests/SnsClientTests/SnsClientTests.swift index 34762e62..0b447552 100644 --- a/Tests/SnsClientTests/SnsClientTests.swift +++ b/Tests/SnsClientTests/SnsClientTests.swift @@ -1,4 +1,4 @@ -import SnapshotTesting +import InlineSnapshotTesting import SnsClient import XCTest @@ -18,7 +18,8 @@ class SnsClientTests: XCTestCase { contentAvailable: true ) ) - _assertInlineSnapshot(matching: apsPayload_NoContent, as: .json, with: """ + assertInlineSnapshot(of: apsPayload_NoContent, as: .json) { + """ { "aps" : { "alert" : { @@ -36,7 +37,7 @@ class SnsClientTests: XCTestCase { } } """ - ) + } struct Content: Encodable { let route: Route @@ -55,7 +56,8 @@ class SnsClientTests: XCTestCase { ), content: Content(route: .init(dailyChallengeId: "deadbeef", localPlayerIndex: 1)) ) - _assertInlineSnapshot(matching: apsPayload_WithContent, as: .json, with: """ + assertInlineSnapshot(of: apsPayload_WithContent, as: .json) { + """ { "aps" : { "alert" : { @@ -69,6 +71,6 @@ class SnsClientTests: XCTestCase { } } """ - ) + } } } diff --git a/Tests/VerifyReceiptMiddlewareTests/VerifyReceiptMiddlewareTests.swift b/Tests/VerifyReceiptMiddlewareTests/VerifyReceiptMiddlewareTests.swift index b46fedc7..a7d85577 100644 --- a/Tests/VerifyReceiptMiddlewareTests/VerifyReceiptMiddlewareTests.swift +++ b/Tests/VerifyReceiptMiddlewareTests/VerifyReceiptMiddlewareTests.swift @@ -1,20 +1,20 @@ import CustomDump import Either -import Foundation -#if canImport(FoundationNetworking) - import FoundationNetworking -#endif import EnvVars import Foundation import HttpPipeline import HttpPipelineTestSupport +import InlineSnapshotTesting import Overture import SharedModels -import SnapshotTesting import XCTest @testable import SiteMiddleware +#if canImport(FoundationNetworking) + import FoundationNetworking +#endif + class VerifyReceiptMiddlewareTests: XCTestCase { let encoder = update(JSONEncoder()) { $0.outputFormatting = [.prettyPrinted, .sortedKeys] @@ -22,9 +22,9 @@ class VerifyReceiptMiddlewareTests: XCTestCase { override func setUp() { super.setUp() -// isRecording=true + // isRecording=true } - + func testHappyPath() { var updatedPlayerId: Player.Id? var updatedAppleResponse: AppleVerifyReceiptResponse? @@ -57,9 +57,10 @@ class VerifyReceiptMiddlewareTests: XCTestCase { request.httpBody = try? self.encoder.encode(AppleVerifyReceiptResponse.mock) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ POST /api/verify-receipt?accessToken=deadbeef-dead-beef-dead-beefdeadbeef - + { "environment" : "Production", "is-retryable" : true, @@ -83,7 +84,7 @@ class VerifyReceiptMiddlewareTests: XCTestCase { }, "status" : 0 } - + 200 OK Content-Length: 63 Content-Type: application/json @@ -93,14 +94,15 @@ class VerifyReceiptMiddlewareTests: XCTestCase { X-Frame-Options: SAMEORIGIN X-Permitted-Cross-Domain-Policies: none X-XSS-Protection: 1; mode=block - + { "verifiedProductIds" : [ "co.pointfree.full_game" ] } + """ - ) + } XCTAssertNoDifference( updatedPlayerId, @@ -143,9 +145,10 @@ class VerifyReceiptMiddlewareTests: XCTestCase { request.httpBody = try? self.encoder.encode(AppleVerifyReceiptResponse.mock) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ POST /api/verify-receipt?accessToken=deadbeef-dead-beef-dead-beefdeadbeef - + { "environment" : "Production", "is-retryable" : true, @@ -169,7 +172,7 @@ class VerifyReceiptMiddlewareTests: XCTestCase { }, "status" : 0 } - + 200 OK Content-Length: 63 Content-Type: application/json @@ -179,14 +182,15 @@ class VerifyReceiptMiddlewareTests: XCTestCase { X-Frame-Options: SAMEORIGIN X-Permitted-Cross-Domain-Policies: none X-XSS-Protection: 1; mode=block - + { "verifiedProductIds" : [ "co.pointfree.full_game" ] } + """ - ) + } XCTAssertNoDifference( updatedPlayerId, @@ -227,9 +231,10 @@ class VerifyReceiptMiddlewareTests: XCTestCase { request.httpBody = try? self.encoder.encode(AppleVerifyReceiptResponse.mock) let result = middleware(connection(from: request)).perform() - _assertInlineSnapshot(matching: result, as: .conn, with: """ + assertInlineSnapshot(of: result, as: .conn) { + """ POST /api/verify-receipt?accessToken=deadbeef-dead-beef-dead-beefdeadbeef - + { "environment" : "Production", "is-retryable" : true, @@ -253,7 +258,7 @@ class VerifyReceiptMiddlewareTests: XCTestCase { }, "status" : 0 } - + 200 OK Content-Length: 63 Content-Type: application/json @@ -263,14 +268,15 @@ class VerifyReceiptMiddlewareTests: XCTestCase { X-Frame-Options: SAMEORIGIN X-Permitted-Cross-Domain-Policies: none X-XSS-Protection: 1; mode=block - + { "verifiedProductIds" : [ "co.pointfree.full_game" ] } + """ - ) + } XCTAssertNoDifference( updatedPlayerId,