Merge remote-tracking branch 'origin' into feat/1695-nullable-localized-array-and-blocks
This commit is contained in:
@@ -15,12 +15,10 @@ import { defaultNumber, numberDoc } from './collections/Number';
|
||||
let client;
|
||||
|
||||
describe('Fields', () => {
|
||||
beforeAll(async (done) => {
|
||||
beforeAll(async () => {
|
||||
const { serverURL } = await initPayloadTest({ __dirname, init: { local: false } });
|
||||
client = new RESTClient(config, { serverURL, defaultSlug: 'point-fields' });
|
||||
await client.login();
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
describe('text', () => {
|
||||
@@ -505,6 +503,29 @@ describe('Fields', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('json', () => {
|
||||
it('should save json data', async () => {
|
||||
const json = { foo: 'bar' };
|
||||
const doc = await payload.create({
|
||||
collection: 'json-fields',
|
||||
data: {
|
||||
json,
|
||||
},
|
||||
});
|
||||
|
||||
expect(doc.json).toStrictEqual({ foo: 'bar' });
|
||||
});
|
||||
|
||||
it('should validate json', async () => {
|
||||
await expect(async () => payload.create({
|
||||
collection: 'json-fields',
|
||||
data: {
|
||||
json: '{ bad input: true }',
|
||||
},
|
||||
})).rejects.toThrow('The following field is invalid: json');
|
||||
});
|
||||
});
|
||||
|
||||
describe('richText', () => {
|
||||
it('should allow querying on rich text content', async () => {
|
||||
const emptyRichTextQuery = await payload.find({
|
||||
|
||||
Reference in New Issue
Block a user