From 5b36398ecda0e93e2b095acbb176be3fb1e0fe66 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Thu, 10 Jul 2025 12:57:36 -0500 Subject: [PATCH 1/2] fix: ANY_STRING_EQUALS waiter matcher match on one string --- .../Tests/WaitersTests/OutputMatcherTests.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/codegen/protocol-test-codegen-local/Tests/swift-codegen/Tests/WaitersTests/OutputMatcherTests.swift b/codegen/protocol-test-codegen-local/Tests/swift-codegen/Tests/WaitersTests/OutputMatcherTests.swift index aeb6b9d1362..51a558114a7 100644 --- a/codegen/protocol-test-codegen-local/Tests/swift-codegen/Tests/WaitersTests/OutputMatcherTests.swift +++ b/codegen/protocol-test-codegen-local/Tests/swift-codegen/Tests/WaitersTests/OutputMatcherTests.swift @@ -226,7 +226,14 @@ class OutputMatcherTests: XCTestCase { // JMESPath comparator: "allStringEquals" // JMESPath expected value: "abc" - func test_projection_acceptorMatchesWhenProjectedValuesMatchExpectation() async throws { + 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))) + } + + 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)) From 65adeabd3929284d484715b89949ef12b8af581d Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Thu, 10 Jul 2025 13:10:59 -0500 Subject: [PATCH 2/2] Add more test cases for string list matching --- .../WaitersTests/OutputMatcherTests.swift | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/codegen/protocol-test-codegen-local/Tests/swift-codegen/Tests/WaitersTests/OutputMatcherTests.swift b/codegen/protocol-test-codegen-local/Tests/swift-codegen/Tests/WaitersTests/OutputMatcherTests.swift index 51a558114a7..2a7cee5d94d 100644 --- a/codegen/protocol-test-codegen-local/Tests/swift-codegen/Tests/WaitersTests/OutputMatcherTests.swift +++ b/codegen/protocol-test-codegen-local/Tests/swift-codegen/Tests/WaitersTests/OutputMatcherTests.swift @@ -226,6 +226,20 @@ class OutputMatcherTests: XCTestCase { // JMESPath comparator: "allStringEquals" // JMESPath expected value: "abc" + 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] @@ -233,6 +247,13 @@ class OutputMatcherTests: XCTestCase { XCTAssertEqual(match, .success(.success(output))) } + 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]