0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Added i18n translate function to test context

refs https://github.com/TryGhost/Ghost/issues/15502

- this allows use of the `t` function whilst running tests
This commit is contained in:
Daniel Lockyer 2023-02-27 13:35:11 +01:00
parent 2804445d41
commit e630acdb88
No known key found for this signature in database

View file

@ -17,6 +17,9 @@ 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,
@ -24,6 +27,7 @@ const customRender = (ui, {options = {}, overrideContext = {}} = {}) => {
brandColor: testSite.accent_color,
page: 'signup',
onAction: mockOnActionFn,
t,
...overrideContext
};
const utils = render(ui, {wrapper: setupProvider(context), ...options});