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

Conversation

trivikr
Copy link
Member

@trivikr trivikr commented Aug 9, 2024

Issue

Internal JS-5234

Description

Fixes TypeScript errors in endpoints-integration.spec.ts

Testing

Before

$ yarn jest -c tests/endpoints-2.0/jest.config.js tests/endpoints-2.0/endpoints-integration.spec.ts
yarn run v1.22.22
$ /local/home/trivikr/workspace/aws-sdk-js-v3/node_modules/.bin/jest -c tests/endpoints-2.0/jest.config.js tests/endpoints-2.0/endpoints-integration.spec.ts
 FAIL  tests/endpoints-2.0/endpoints-integration.spec.ts
  ● Test suite failed to run

    tests/endpoints-2.0/endpoints-integration.spec.ts:22:7 - error TS7034: Variable 'defaultEndpointResolver' implicitly has type 'any' in some locations where its type cannot be determined.

    22   let defaultEndpointResolver;
             ~~~~~~~~~~~~~~~~~~~~~~~
    tests/endpoints-2.0/endpoints-integration.spec.ts:23:7 - error TS7034: Variable 'namespace' implicitly has type 'any' in some locations where its type cannot be determined.

    23   let namespace;
             ~~~~~~~~~
    tests/endpoints-2.0/endpoints-integration.spec.ts:24:7 - error TS7034: Variable 'model' implicitly has type 'any' in some locations where its type cannot be determined.

    24   let model;
             ~~~~~
    tests/endpoints-2.0/endpoints-integration.spec.ts:43:9 - error TS7005: Variable 'defaultEndpointResolver' implicitly has an 'any' type.

    43     if (defaultEndpointResolver && namespace && model) {
               ~~~~~~~~~~~~~~~~~~~~~~~
    tests/endpoints-2.0/endpoints-integration.spec.ts:43:36 - error TS7005: Variable 'namespace' implicitly has an 'any' type.

    43     if (defaultEndpointResolver && namespace && model) {
                                          ~~~~~~~~~
    tests/endpoints-2.0/endpoints-integration.spec.ts:43:49 - error TS7005: Variable 'model' implicitly has an 'any' type.

    43     if (defaultEndpointResolver && namespace && model) {
                                                       ~~~~~
    tests/endpoints-2.0/endpoints-integration.spec.ts:44:73 - error TS7053: Element implicitly has an 'any' type because expression of type '"type"' can't be used to index type '{}'.
      Property 'type' does not exist on type '{}'.

    44       const [, service] = Object.entries(model.shapes).find(([k, v]) => v?.["type"] === "service") as any;
                                                                               ~~~~~~~~~~~
    tests/endpoints-2.0/endpoints-integration.spec.ts:109:21 - error TS7006: Parameter 'err' implicitly has an 'any' type.

    109       const pass = (err) => err;
                            ~~~
    tests/endpoints-2.0/endpoints-integration.spec.ts:110:32 - error TS7006: Parameter 's' implicitly has an 'any' type.

    110       const normalizeQuotes = (s) => s.replace(/`/g, "");
                                       ~

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        3.546 s
Ran all test suites matching /tests\/endpoints-2.0\/endpoints-integration.spec.ts/i.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

After

$ yarn jest -c tests/endpoints-2.0/jest.config.js tests/endpoints-2.0/endpoints-integration.spec.ts
...
Test Suites: 1 passed, 1 total
Tests:       124 skipped, 14548 passed, 14672 total
Snapshots:   0 total
Time:        127.315 s
Ran all test suites matching /tests\/endpoints-2.0\/endpoints-integration.spec.ts/i.
Done in 128.22s.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@trivikr trivikr requested a review from a team as a code owner August 9, 2024 14:10
@trivikr trivikr merged commit 61505ca into aws:main Aug 9, 2024
5 checks passed
@trivikr trivikr deleted the endpoints-integration branch August 9, 2024 14:35
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants