Skip to content

Commit

Permalink
update command (to account for breaking change)
Browse files Browse the repository at this point in the history
  • Loading branch information
Šimon Macek authored and tmszi committed Sep 24, 2024
1 parent 8d1f636 commit be1365c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 57 deletions.
27 changes: 5 additions & 22 deletions src/components/__tests__/CountdownEvent.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,11 @@ describe('<CountdownEvent>', () => {
});

it('has translation for all strings', () => {
const translationKeyList = [
'index.countdown.title',
'index.countdown.days',
'index.countdown.hours',
'index.countdown.minutes',
'index.countdown.seconds',
];

translationKeyList.forEach((translationKey) => {
const defaultEnglishString = i18n.global.t(translationKey, 'en');

const locales = i18n.global.availableLocales;
locales
.filter((locale) => locale !== 'en')
.forEach((locale) => {
i18n.global.locale = locale;
const translatedString = i18n.global.t(translationKey);
cy.wrap(translatedString)
.should('be.a', 'string')
.and('not.equal', defaultEnglishString);
});
});
cy.testLanguageStringsInContext(
['title', 'days', 'hours', 'minutes', 'seconds'],
'index.countdown',
i18n,
);
});

it('displays internationalized labels', () => {
Expand Down
46 changes: 15 additions & 31 deletions src/components/__tests__/DrawerHeader.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,22 @@ describe('<DrawerHeader>', () => {
});

it('has translation for all strings', () => {
const translationStrings = [
'titleStateDefault',
'titleStateContact',
'titleParticipants',
'titleCoordinators',
'titleGuide',
'buttonGuide',
'titleContact',
'buttonContact',
'titleLinks',
'titleSocials',
];

const translationKeyList = translationStrings.map(
(item) => `index.help.${item}`,
cy.testLanguageStringsInContext(
[
'titleStateDefault',
'titleStateContact',
'titleParticipants',
'titleCoordinators',
'titleGuide',
'buttonGuide',
'titleContact',
'buttonContact',
'titleLinks',
'titleSocials',
],
'index.help',
i18n,
);

translationKeyList.forEach((translationKey) => {
const defaultEnglishString = i18n.global.t(translationKey, 'en');

const locales = i18n.global.availableLocales;
locales
.filter((locale) => locale !== 'en')
.forEach((locale) => {
i18n.global.locale = locale;
const translatedString = i18n.global.t(translationKey);

cy.wrap(translatedString)
.should('be.a', 'string')
.and('not.equal', defaultEnglishString);
});
});
});

it('renders logo', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ labelCompanyShort = "Company"
labelConfirmBillingDetails = "I confirm that the billing information above is correct"
labelCoordinatorResponsibility = "I will arrange for the company to pay all or part of the entry fee for our employee team(s)."
labelDonorEntryFee = "My organisation would like to support AutoMat and pay a charity entry fee of 500 CZK excluding VAT per person"
labelEmail = "E-mail"
labelEmail = "Email"
labelFirstName = "First Name"
labelGender = "Gender"
labelHouseNumber = "House number"
Expand Down
13 changes: 10 additions & 3 deletions test/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,21 @@ Cypress.Commands.add(
);

translationKeyList.forEach((translationKey) => {
const defaultEnglishString = i18n.global.t(translationKey, 'en');
const defaultEnglishString = i18n.global.t(
translationKey,
{},
{ locale: 'en' },
);

const locales = i18n.global.availableLocales;
locales
.filter((locale) => locale !== 'en')
.forEach((locale) => {
i18n.global.locale = locale;
const translatedString = i18n.global.t(translationKey);
const translatedString = i18n.global.t(
translationKey,
{},
{ locale: locale },
);

cy.wrap(translatedString)
.should('be.a', 'string')
Expand Down

0 comments on commit be1365c

Please sign in to comment.