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(alert-rules): Add a barebones spec test for the RuleNode component #28834

Merged
merged 1 commit into from
Sep 29, 2021

Conversation

leeandher
Copy link
Member

Related: #28828

This PR adds a barebones spec test to the Rule Node component. It ensures that the Text, Number and Choice fields work correctly, with special consideration for the number -> string weirdness in the linked PR above. It also includes a lot of TODOs as those are a bit out of my scope, but would be great additions by someone with more context into those rules.

There are a few TODOs I've assigned myself that will be addressed as part of a new rule I'm building (See: #28659)

@leeandher leeandher requested a review from a team September 24, 2021 19:28
Comment on lines -69 to -71
initialVal = fieldConfig.initial;
} else {
initialVal = fieldConfig.choices[0][0];
Copy link
Member Author

Choose a reason for hiding this comment

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

Even though the field when changed will provide strings (as per #28828), I believe this original intention behind this code was to always have a value in the field even on first load with no default set.

This coerces every possible value into a string so that those fields will start of populated.

@leeandher leeandher requested a review from a team September 24, 2021 19:30
Copy link
Contributor

@taylangocmen taylangocmen left a comment

Choose a reason for hiding this comment

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

lgtm

@leeandher leeandher merged commit 0ae2c82 into master Sep 29, 2021
@leeandher leeandher deleted the leander/tests/rule-node branch September 29, 2021 16:47
@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 2021
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