Skip to content

Commit

Permalink
test: server maintain schema
Browse files Browse the repository at this point in the history
  • Loading branch information
drdevelop committed Nov 19, 2023
1 parent 581a011 commit e98105f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/form/tests/schema/serverMaintain.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import SchemaForm, { stringifySchema, parseSchema } from '../../src';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';

it('stringify schema', () => {
// eslint-disable-next-line
// @ts-ignore
// eslint-disable-next-line
expect(stringifySchema({a: 1})).toBe(
// eslint-disable-next-line
`{
"a": 1
}`,
);
});

function TestComponent() {
const schema = parseSchema(`
[ { "fieldName": "schema", "label": "schema", "type": "textarea" } ]
`);
return <SchemaForm schema={schema} />;
}

it('parse schema', () => {
render(<TestComponent />);
expect(screen.getByText('schema')).toBeInTheDocument();
});

0 comments on commit e98105f

Please sign in to comment.