|
@@ -1,5 +1,6 @@
|
|
|
import merge from 'lodash.merge';
|
|
|
-import Cookies from 'js-cookie';
|
|
|
+import { deleteCookie, setCookie } from 'cookies-next';
|
|
|
+import { fromPartial } from '@total-typescript/shoehorn';
|
|
|
import { getAuthedPageProps, getMessagesPageProps } from '../page-helpers';
|
|
|
import englishMessages from '../../messages/en.json';
|
|
|
import frenchMessages from '../../messages/fr-FR.json';
|
|
@@ -33,7 +34,7 @@ describe('test: getAuthedPageProps()', () => {
|
|
|
|
|
|
describe('test: getMessagesPageProps()', () => {
|
|
|
beforeEach(() => {
|
|
|
- Cookies.remove('locale');
|
|
|
+ deleteCookie('tipi-locale');
|
|
|
});
|
|
|
|
|
|
it('should return correct messages if the locale is in the session', async () => {
|
|
@@ -51,7 +52,7 @@ describe('test: getMessagesPageProps()', () => {
|
|
|
it('should return correct messages if the locale in the cookie', async () => {
|
|
|
// arrange
|
|
|
const ctx = { req: { session: {}, headers: {} } };
|
|
|
- Cookies.set('locale', 'fr-FR');
|
|
|
+ setCookie('tipi-locale', 'fr-FR', { req: fromPartial(ctx.req) });
|
|
|
|
|
|
// act
|
|
|
// @ts-expect-error - we're passing in a partial context
|