Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,35 @@ class OutputMatcherTests: XCTestCase {
// JMESPath comparator: "allStringEquals"
// JMESPath expected value: "abc"

func test_projection_acceptorMatchesWhenProjectedValuesMatchExpectation() async throws {
func test_projection_acceptorDoesNotMatchWhenProjectedValueIsNil() async throws {
let output = GetWidgetOutput(dataMap: nil)
let subject = try WaitersClient.projectionMatcherWaiterConfig().acceptors[0]
let match = subject.evaluate(input: anInput, result: .success(output))
XCTAssertNil(match)
}

func test_projection_acceptorDoesNotMatchWhenProjectedValueIsEmpty() async throws {
let output = GetWidgetOutput(dataMap: [:])
let subject = try WaitersClient.projectionMatcherWaiterConfig().acceptors[0]
let match = subject.evaluate(input: anInput, result: .success(output))
XCTAssertNil(match)
}

func test_projection_acceptorMatchesWhenSingleProjectedValueMatchesExpectation() async throws {
let output = GetWidgetOutput(dataMap: ["x": "abc"])
let subject = try WaitersClient.projectionMatcherWaiterConfig().acceptors[0]
let match = subject.evaluate(input: anInput, result: .success(output))
XCTAssertEqual(match, .success(.success(output)))
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test case above is the specific scenario that the bugfix addresses.

The other three tests here were added for completeness.


func test_projection_acceptorMatchesWhenSingleProjectedValueDoesNotMatchExpectation() async throws {
let output = GetWidgetOutput(dataMap: ["x": "def"])
let subject = try WaitersClient.projectionMatcherWaiterConfig().acceptors[0]
let match = subject.evaluate(input: anInput, result: .success(output))
XCTAssertNil(match)
}

func test_projection_acceptorMatchesWhenMultipleProjectedValuesMatchExpectation() async throws {
let output = GetWidgetOutput(dataMap: ["x": "abc", "y": "abc", "z": "abc"])
let subject = try WaitersClient.projectionMatcherWaiterConfig().acceptors[0]
let match = subject.evaluate(input: anInput, result: .success(output))
Expand Down
Loading