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

feat: fix mock calling structs #59

Merged
merged 2 commits into from
Apr 15, 2024
Merged

Conversation

agusduha
Copy link
Member

🤖 Linear

Closes BES-143

@agusduha agusduha requested a review from gas1cent April 15, 2024 13:13
Copy link

linear bot commented Apr 15, 2024

src/utils.ts Outdated
Comment on lines 454 to 460
export const extractStructFields = (node: TypeName): string[] | null => {
const fields = getStructFields(node);

if (!fields.length) return null;

return fields.map((field) => (field as VariableDeclaration).name).filter((name) => name);
};
Copy link
Member

Choose a reason for hiding this comment

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

2 small improvements to this function:

  • we can try to avoid confusion between extractStructFields and getStructFields by naming the former something like extractFieldNames
  • let's return [] in case the fields variable is empty for consistency (the other function does that) and to prevent null checks in code

@gas1cent gas1cent merged commit 200fbf8 into dev Apr 15, 2024
3 checks passed
@gas1cent gas1cent deleted the feat/fix-mock-calling-structs branch April 15, 2024 14:56
@gas1cent gas1cent added this to the v1.3.0 milestone Apr 15, 2024
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