Skip to content

Commit

Permalink
Added i18n translate function to test context
Browse files Browse the repository at this point in the history
refs #15502

- this allows use of the `t` function whilst running tests
  • Loading branch information
daniellockyer committed Feb 27, 2023
1 parent 2804445 commit e630acd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ghost/portal/src/utils/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ const setupProvider = (context) => {
const customRender = (ui, {options = {}, overrideContext = {}} = {}) => {
const mockOnActionFn = jest.fn().mockResolvedValue(undefined);

// Hardcode the locale to 'en' for testing
const {t} = require('@tryghost/i18n')('en');

const context = {
site: testSite,
member: member.free,
action: 'init:success',
brandColor: testSite.accent_color,
page: 'signup',
onAction: mockOnActionFn,
t,
...overrideContext
};
const utils = render(ui, {wrapper: setupProvider(context), ...options});
Expand Down

0 comments on commit e630acd

Please sign in to comment.