Merge remote-tracking branch 'origin/next' into develop
Some checks failed
Build docker image / build-and-push (push) Has been cancelled
Build pro image / build-and-push (push) Has been cancelled
E2E / Build (push) Has been cancelled
E2E / Core and plugins (push) Has been cancelled
E2E / plugin-workflow (push) Has been cancelled
E2E / plugin-workflow-approval (push) Has been cancelled
E2E / plugin-data-source-main (push) Has been cancelled
E2E / Comment on PR (push) Has been cancelled

This commit is contained in:
xilesun 2024-11-15 22:38:38 +08:00
commit 9521aee152
3 changed files with 11 additions and 12 deletions

View File

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

View File

@ -60,6 +60,9 @@ export class CacheManager {
redis: {
store: redisStore,
close: async (redis: RedisStore) => {
if (!redis.client?.isOpen) {
return;
}
await redis.client.quit();
},
},

View File

@ -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(<JSONInput />);
const { container } = render(<App4 />);
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 () => {