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:
parent
2804445d41
commit
e630acdb88
1 changed files with 4 additions and 0 deletions
|
@ -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});
|
||||
|
|
Loading…
Add table
Reference in a new issue