From e630acdb88441090ea37f88186cda6e255d20c08 Mon Sep 17 00:00:00 2001
From: Daniel Lockyer <hi@daniellockyer.com>
Date: Mon, 27 Feb 2023 13:35:11 +0100
Subject: [PATCH] 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
---
 ghost/portal/src/utils/test-utils.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ghost/portal/src/utils/test-utils.js b/ghost/portal/src/utils/test-utils.js
index 20984d346d..e2ee90db17 100644
--- a/ghost/portal/src/utils/test-utils.js
+++ b/ghost/portal/src/utils/test-utils.js
@@ -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});