From c366769536f4bf7b6122d75ee1a51fd19231bad4 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Fri, 9 Aug 2024 19:24:48 +0000 Subject: [PATCH] test(endpoints): read tests from serviceModel --- .../endpoints-2.0/endpoints-integration.spec.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/endpoints-2.0/endpoints-integration.spec.ts b/tests/endpoints-2.0/endpoints-integration.spec.ts index 69f8ff6b8d917..e1bfbd3d1efbe 100644 --- a/tests/endpoints-2.0/endpoints-integration.spec.ts +++ b/tests/endpoints-2.0/endpoints-integration.spec.ts @@ -37,12 +37,7 @@ describe("client list", () => { const [, service] = Object.entries(model.shapes).find( ([k, v]) => typeof v === "object" && v !== null && "type" in v && v.type === "service" ) as any; - const [, tests] = Object.entries(service.traits).find(([k, v]) => k === "smithy.rules#endpointTests") as any; - if (tests?.testCases) { - runTestCases(tests, service, defaultEndpointResolver, ""); - } else { - it.skip("has no test cases", () => {}); - } + runTestCases(service, defaultEndpointResolver, ""); } else { it.skip("unable to load endpoint resolver, or test cases", () => {}); } @@ -50,13 +45,17 @@ describe("client list", () => { }); function runTestCases( - { testCases }: { testCases: EndpointTestCase[] }, service: ServiceNamespace, defaultEndpointResolver: (endpointParams: EndpointParameters) => EndpointV2, serviceId: string ) { - for (const testCase of testCases) { - runTestCase(testCase, service, defaultEndpointResolver, serviceId); + const [, tests] = Object.entries(service.traits).find(([k, v]) => k === "smithy.rules#endpointTests") as any; + if (tests?.testCases) { + for (const testCase of tests.testCases) { + runTestCase(testCase, service, defaultEndpointResolver, serviceId); + } + } else { + it.skip("has no test cases", () => {}); } }