Skip to content

Instantly share code, notes, and snippets.

@erd

erd/BootstrapApiTest.swift

Last active Oct 31, 2018
Embed
What would you like to do?
Contract Testing with Pact #15
var provider: MockService!
var client: BootstrapClient!
beforeEach {
provider = MockService(provider: "consumer-mobile-bff", consumer: "consumer-ios")
client = BootstrapClient(baseUrl: provider!.baseUrl)
}
it("should fetch bootstrap information from provider") {
provider!.given("default")
.uponReceiving("Fetching application bootstrap information")
.withRequest(method: .GET, path: "/v1/bootstrap")
.willRespondWith(status:200, headers: ["Content-Type": "application/json"], body:
{"version": {"minimum_version": "1.0", "current_version": "2.0"}}
)
provider!.run { (testComplete) -> Void in
client!.bootstrap { (response) in
expect(response.version.minimumVersion).to(equal("1.0"))
expect(response.version.currentVersion).to(equal("2.0"))
testComplete()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment