mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
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
This commit is contained in:
parent
97358707f9
commit
60225a11c5
4
.github/workflows/nocobase-test-frontend.yml
vendored
4
.github/workflows/nocobase-test-frontend.yml
vendored
@ -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'
|
||||
|
@ -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 () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user