From 60225a11c5b5f1b69659661490ee99ff42f86034 Mon Sep 17 00:00:00 2001 From: Junyi Date: Fri, 15 Nov 2024 18:12:36 +0800 Subject: [PATCH 1/2] chore(ci): change fe test based on node 20 (#5657) * chore(ci): change fe test based on node 20 * chore(ci): change setup-node to v4 * fix(client): fix test case * fix(client): fix test case --- .github/workflows/nocobase-test-frontend.yml | 4 ++-- .../antd/input/__tests__/Input.test.tsx | 16 ++++++---------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/nocobase-test-frontend.yml b/.github/workflows/nocobase-test-frontend.yml index d08413e0156..91aba59f24a 100644 --- a/.github/workflows/nocobase-test-frontend.yml +++ b/.github/workflows/nocobase-test-frontend.yml @@ -33,14 +33,14 @@ jobs: frontend-test: strategy: matrix: - node_version: ['18'] + node_version: ['20'] runs-on: ubuntu-latest container: node:${{ matrix.node_version }} steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node_version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node_version }} cache: 'yarn' diff --git a/packages/core/client/src/schema-component/antd/input/__tests__/Input.test.tsx b/packages/core/client/src/schema-component/antd/input/__tests__/Input.test.tsx index 8084934176c..df41d6a42d5 100644 --- a/packages/core/client/src/schema-component/antd/input/__tests__/Input.test.tsx +++ b/packages/core/client/src/schema-component/antd/input/__tests__/Input.test.tsx @@ -12,6 +12,7 @@ import React from 'react'; import App1 from '../demos/input'; import App2 from '../demos/textarea'; import App3 from '../demos/url'; +import App4 from '../demos/json'; import JSON5 from 'json5'; import JSONInput from '../demos/new-demos/json'; import JSON5Input from '../demos/new-demos/json5'; @@ -131,18 +132,13 @@ describe('Input.JSON', () => { }); it('should display the error when the value is invalid', async () => { - const { container } = render(); + const { container } = render(); await waitFor(() => { - expect(screen.getByText('Test').innerHTML).toBe('Test'); + const textarea = container.querySelector('textarea') as HTMLTextAreaElement; + fireEvent.change(textarea, { target: { value: '{"name":nocobase}' } }); + fireEvent.blur(textarea, { target: { value: '{"name":nocobase}' } }); + expect(screen.getByText(/Unexpected token/)).toBeInTheDocument(); }); - - const textarea = container.querySelector('textarea') as HTMLTextAreaElement; - await userEvent.clear(textarea); - // To escape special characters, use double curly braces - await userEvent.type(textarea, '{{name:"nocobase"}'); - // mock blur event - await userEvent.click(document.body); - expect(screen.getByText(/Unexpected token n/)).toBeInTheDocument(); }); it('should not display error when the value is valid JSON5', async () => { From ab4e470e70045453b633a6c4f419f1f7ec834ee4 Mon Sep 17 00:00:00 2001 From: YANG QIA <2013xile@gmail.com> Date: Fri, 15 Nov 2024 22:28:02 +0800 Subject: [PATCH 2/2] fix(cache): check if client is opening when attempting to close redis client (#5660) --- packages/core/cache/src/cache-manager.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/core/cache/src/cache-manager.ts b/packages/core/cache/src/cache-manager.ts index e39545b10e6..fe10100314f 100644 --- a/packages/core/cache/src/cache-manager.ts +++ b/packages/core/cache/src/cache-manager.ts @@ -60,6 +60,9 @@ export class CacheManager { redis: { store: redisStore, close: async (redis: RedisStore) => { + if (!redis.client?.isOpen) { + return; + } await redis.client.quit(); }, },