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

chore: Fix Run API test type warnings #2343

Merged
merged 2 commits into from
Oct 27, 2023
Merged

chore: Fix Run API test type warnings #2343

merged 2 commits into from
Oct 27, 2023

Conversation

DafyddLlyr
Copy link
Contributor

@DafyddLlyr DafyddLlyr commented Oct 26, 2023

What does this PR do?

  • Address some eslint warnings in API tests
  • Imports and uses types from planx-core

I've been staring at the message below a fair amount these past few days trying to sort E2E tests, so this is just a quick pass at addressing a few of these issues.

image

Next steps...

The eventual aim would be to remove the Passport / Flow etc types from the API and just use the ones from planx-core. This isn't a small change though so I'll just try chipping away at them here and there as a maintenance task 👍

@github-actions
Copy link

github-actions bot commented Oct 26, 2023

Removed vultr server and associated DNS entries

?.map(([_nodeId, nodeData]) => nodeData?.data?.allowInviteToPay);
const inviteToPayEnabled = (flowGraph: FlowGraph): boolean => {
const payNodes = Object.entries(flowGraph).filter(
(entry): entry is [string, Node] =>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type narrowing here has to be repeated as it doesn't propagate as expected from the function which is being called.

microsoft/TypeScript#12798

type: ComponentType,
): entry is [string, Node] => {
const [nodeId, node] = entry;
if (nodeId === "_root") return false;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative (and possibly better) solution to this would be to add type property to the root node (ComponentType._Root?).

@DafyddLlyr DafyddLlyr marked this pull request as ready for review October 26, 2023 12:46
@DafyddLlyr DafyddLlyr requested a review from a team October 26, 2023 12:46
Copy link
Member

@jessicamcinchak jessicamcinchak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for these tidy ups! I can try to revisit those lingering Digital Land ones soon - I think it's just a matter of typing the shape the expected response from their Entity & Metadata endpoints.

export interface Node {
id?: string;
data?: Record<string, any>;
edges?: Array<string>;
type?: number;
}

/**
* @deprecated Migrating to Flow and FlowGraph from planx-core
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 these are helpful reminders, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep - hopefully it just means when we next need to reach for a type we avoid these ones 👌

@DafyddLlyr DafyddLlyr merged commit 6693053 into main Oct 27, 2023
10 checks passed
@DafyddLlyr DafyddLlyr deleted the dp/api-test-types branch October 27, 2023 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants