-
Notifications
You must be signed in to change notification settings - Fork 364
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
fix: [M3-6430] - Event entities should only be linked for true labels #9003
fix: [M3-6430] - Event entities should only be linked for true labels #9003
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! @abailly-akamai
@@ -87,4 +88,52 @@ describe('Event message generation', () => { | |||
).not.toMatch('booted with'); | |||
}); | |||
}); | |||
|
|||
describe('apply linking to labels', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding test coverage!
const mockEvent = { | ||
action: 'create', | ||
entity: null, | ||
secondary_entity: null, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the eventFactory
from packages/manager/src/factories/events.ts
to create the mockEvent
s so we don't have to type cast?
What can we do to avoid message as any
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
message
is a required prop, which can't be null
which is why it's casted. not particularly important to be very strict with the type here. That being said I refactored some of the unit to use the factory for events 👍
Description 📝
Issue
Our
applyLinking
script was attempting to replace entity labels within backticks, resulting in plaintext HTML in our event list. It was also not linking the true entity because the replace instance wasn't using a global modifier in case two instances of the label were matching.Solution
Modified the replace to only target true labels and leave alone strings surrounded by backticks. Also added a test for the
applyLinking
functionPreview 📷
Before
After
How to test 🧪