Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix TypeScript errors in endpoints-integration.spec.ts #6372

Merged
merged 1 commit into from
Aug 9, 2024
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
14 changes: 8 additions & 6 deletions tests/endpoints-2.0/endpoints-integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ describe("client list", () => {
for (const client of clientList) {
const serviceName = client.slice(7);

let defaultEndpointResolver;
let namespace;
let model;
let defaultEndpointResolver: any;
let namespace: any;
let model: any;

// this may also work with dynamic async import() in a beforeAll() block,
// but needs more effort than using synchronous require().
Expand All @@ -41,7 +41,9 @@ for (const client of clientList) {

describe(`client-${serviceName} endpoint test cases`, () => {
if (defaultEndpointResolver && namespace && model) {
const [, service] = Object.entries(model.shapes).find(([k, v]) => v?.["type"] === "service") as any;
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, "");
Expand Down Expand Up @@ -106,8 +108,8 @@ async function runTestCase(
}
if (isErrorExpectation(expectation)) {
const { error } = expectation;
const pass = (err) => err;
const normalizeQuotes = (s) => s.replace(/`/g, "");
const pass = (err: any) => err;
const normalizeQuotes = (s: string) => s.replace(/`/g, "");
if (operationInputs) {
for (const operationInput of operationInputs) {
const { operationName, operationParams = {} } = operationInput;
Expand Down
Loading