Skip to content

Commit

Permalink
[i18n PR feedback] Prefer specific token skipping over all functions …
Browse files Browse the repository at this point in the history
…skipping
  • Loading branch information
cee-chen committed Aug 25, 2021
1 parent e40ebfa commit a0853fe
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/public/i18n/i18n_eui_mapping.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ describe('@elastic/eui i18n tokens', () => {
});

test('defaultMessage is in sync with defString', () => {
// Certain complex tokens (e.g. ones that have a function as a defaultMessage)
// need custom i18n handling, and can't be checked for basic defString equality
const tokensToSkip = ['euiColumnSorting.buttonActive'];
if (tokensToSkip.includes(token)) return;

// Clean up typical errors from the `@elastic/eui` extraction token tool
const normalizedDefString = defString
// Quoted words should use double-quotes
Expand All @@ -85,9 +90,6 @@ describe('@elastic/eui i18n tokens', () => {
.replace(/\s{2,}/g, ' ')
.trim();

// Skip defStrings that are functions
if (normalizedDefString.match(/^\(.*?\).*?=>/)) return;

expect(i18nTranslateCall[1].defaultMessage).toBe(normalizedDefString);
});

Expand Down

0 comments on commit a0853fe

Please sign in to comment.