Merge pull request #2206 from payloadcms/fix/2189-empty-json

fix: allows empty objects to be retained in db
This commit is contained in:
James Mikrut
2023-02-28 10:45:46 -05:00
committed by GitHub
8 changed files with 47 additions and 4 deletions

View File

@@ -524,6 +524,19 @@ describe('Fields', () => {
},
})).rejects.toThrow('The following field is invalid: json');
});
it('should save empty json objects', async () => {
const createdJSON = await payload.create({
collection: 'json-fields',
data: {
json: {
state: {},
},
},
});
expect(createdJSON.json.state).toBeDefined();
});
});
describe('richText', () => {