Skip to content

Commit

Permalink
chore: feature event formatter md format style (#8222)
Browse files Browse the repository at this point in the history
https://linear.app/unleash/issue/2-2697/implement-proper-markdown-bold-format-in-feature-event-formatter-md

This is a follow up to #8205,
specifically [this
comment](#8205 (comment))
from @gastonfournier

Implements an easy way to switch between formatting styles in our event
formatter. This enhancement will allow us to generate fully
markdown-formatted event summaries when needed, while preserving the
simplistic markdown formatting currently supported by platforms like
Slack.

Also includes some slight scouting. See comments for details.
  • Loading branch information
nunogois authored Sep 24, 2024
1 parent 7d916e9 commit 72bdce9
Show file tree
Hide file tree
Showing 10 changed files with 440 additions and 403 deletions.
8 changes: 3 additions & 5 deletions src/lib/addons/datadog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
import {
type FeatureEventFormatter,
FeatureEventFormatterMd,
LinkStyle,
} from './feature-event-formatter-md';
import type { IEvent } from '../types/events';
import type { IntegrationEventState } from '../features/integration-events/integration-events-store';
Expand Down Expand Up @@ -38,10 +37,9 @@ export default class DatadogAddon extends Addon {

constructor(config: IAddonConfig) {
super(definition, config);
this.msgFormatter = new FeatureEventFormatterMd(
config.unleashUrl,
LinkStyle.MD,
);
this.msgFormatter = new FeatureEventFormatterMd({
unleashUrl: config.unleashUrl,
});
this.flagResolver = config.flagResolver;
}

Expand Down
359 changes: 359 additions & 0 deletions src/lib/addons/feature-event-formatter-md-events.ts

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/lib/addons/feature-event-formatter-md.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,9 @@ const testCases: [string, IEvent][] = [

testCases.forEach(([description, event]) =>
test(`Should format specialised text for events ${description}`, () => {
const formatter = new FeatureEventFormatterMd('unleashUrl');
const formatter = new FeatureEventFormatterMd({
unleashUrl: 'unleashUrl',
});
const formattedEvent = formatter.format(event);
expect(formattedEvent).toMatchSnapshot();
}),
Expand Down
Loading

0 comments on commit 72bdce9

Please sign in to comment.