Skip to content

Commit

Permalink
test(endpoints): use describe.each
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Aug 9, 2024
1 parent 45a1129 commit 728b7b9
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions tests/endpoints-2.0/endpoints-integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("client list", () => {
expect(clientList.length).toBeGreaterThan(300);
});

for (const client of clientList) {
describe.each(clientList)(`%s endpoint test cases`, (client) => {
const serviceName = client.slice(7);

let defaultEndpointResolver: any;
Expand All @@ -33,22 +33,20 @@ describe("client list", () => {
}
}

describe(`client-${serviceName} endpoint test cases`, () => {
if (defaultEndpointResolver && model) {
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", () => {});
}
if (defaultEndpointResolver && model) {
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("unable to load endpoint resolver, or test cases", () => {});
it.skip("has no test cases", () => {});
}
});
}
} else {
it.skip("unable to load endpoint resolver, or test cases", () => {});
}
});
});

function runTestCases(
Expand Down

0 comments on commit 728b7b9

Please sign in to comment.