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

Add some tests to the variable resolver to ensure static JSON is properly evaluated #9104

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

Devessier
Copy link
Contributor

No description provided.

@Devessier Devessier requested a review from thomtrp December 17, 2024 15:50
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Added test coverage for JSON string handling in the variable resolver utility, focusing on variable interpolation and static JSON preservation.

  • Added test case in /packages/twenty-server/src/modules/workflow/workflow-executor/utils/__tests__/variable-resolver.util.spec.ts to verify JSON property names with variables
  • Added test case to ensure static JSON strings remain unmodified
  • Added test cases for variable interpolation in JSON number and string values
  • Added test to verify variables in JSON strings don't get wrapped with double quotes

1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +78 to +84
it('does not wrap string variables with double quotes', () => {
expect(
resolveInput('{ {{test}}: 2 }', {
test: 'prop',
}),
).toBe('{ prop: 2 }');
});
Copy link
Contributor

Choose a reason for hiding this comment

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

style: The whitespace in the expected string '{ prop: 2 }' may be implementation-dependent. Consider testing the parsed JSON object instead of the string representation.

@Devessier Devessier merged commit f05a217 into main Dec 17, 2024
22 checks passed
@Devessier Devessier deleted the variable-resolver-add-json-string-tests branch December 17, 2024 16:02
Copy link

Thanks @Devessier for your contribution!
This marks your 36th PR on the repo. You're top 1% of all our contributors 🎉
See contributor page - Share on LinkedIn - Share on Twitter

Contributions

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