浏览代码

chore: remove @types/js-cookie

Nicolas Meienberger 2 年之前
父节点
当前提交
0cd1a877f1
共有 3 个文件被更改,包括 4 次插入11 次删除
  1. 0 1
      package.json
  2. 0 7
      pnpm-lock.yaml
  3. 4 3
      src/client/utils/__tests__/page-helpers.test.ts

+ 0 - 1
package.json

@@ -100,7 +100,6 @@
     "@types/fs-extra": "^11.0.1",
     "@types/isomorphic-fetch": "^0.0.36",
     "@types/jest": "^29.5.2",
-    "@types/js-cookie": "^3.0.3",
     "@types/lodash.merge": "^4.6.7",
     "@types/node": "20.2.5",
     "@types/node-cron": "^3.0.2",

+ 0 - 7
pnpm-lock.yaml

@@ -210,9 +210,6 @@ devDependencies:
   '@types/jest':
     specifier: ^29.5.2
     version: 29.5.2
-  '@types/js-cookie':
-    specifier: ^3.0.3
-    version: 3.0.3
   '@types/lodash.merge':
     specifier: ^4.6.7
     version: 4.6.7
@@ -2965,10 +2962,6 @@ packages:
       pretty-format: 29.5.0
     dev: true
 
-  /@types/js-cookie@3.0.3:
-    resolution: {integrity: sha512-Xe7IImK09HP1sv2M/aI+48a20VX+TdRJucfq4vfRVy6nWN8PYPOEnlMRSgxJAgYQIXJVL8dZ4/ilAM7dWNaOww==}
-    dev: true
-
   /@types/js-levenshtein@1.1.1:
     resolution: {integrity: sha512-qC4bCqYGy1y/NP7dDVr7KJarn+PbX1nSpwA7JXdu0HxT3QYjO8MJ+cntENtHFVy2dRAyBV23OZ6MxsW1AM1L8g==}
     dev: true

+ 4 - 3
src/client/utils/__tests__/page-helpers.test.ts

@@ -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