chore: fix broken fields test (#5492)

This commit is contained in:
Dan Ribbens
2024-03-27 12:39:09 -04:00
committed by GitHub
parent 3b5e7f1dc4
commit 2fb265ae2d

View File

@@ -7,6 +7,7 @@ import type { NextRESTClient } from '../helpers/NextRESTClient.js'
import type { GroupField, RichTextField } from './payload-types.js'
import { devUser } from '../credentials.js'
import { initPayloadInt } from '../helpers/initPayloadInt.js'
import { isMongoose } from '../helpers/isMongoose.js'
import { arrayDefaultValue } from './collections/Array/index.js'
import { blocksDoc } from './collections/Blocks/shared.js'
@@ -37,7 +38,6 @@ import {
let restClient: NextRESTClient
let user: any
let payload: Payload
import { initPayloadInt } from '../helpers/initPayloadInt.js'
describe('Fields', () => {
beforeAll(async () => {
@@ -599,6 +599,7 @@ describe('Fields', () => {
it('should not throw validation error saving multiple null values for unique fields', async () => {
const data = {
localizedUniqueRequiredText: 'en1',
text: 'a',
uniqueRequiredText: 'a',
// uniqueText omitted on purpose
@@ -610,7 +611,7 @@ describe('Fields', () => {
data.uniqueRequiredText = 'b'
const result = await payload.create({
collection: 'indexed-fields',
data,
data: { ...data, localizedUniqueRequiredText: 'en2' },
})
expect(result.id).toBeDefined()
@@ -625,8 +626,8 @@ describe('Fields', () => {
data,
})
const result = await payload.duplicate({
collection: 'indexed-fields',
id: doc.id,
collection: 'indexed-fields',
})
expect(result.id).not.toEqual(doc.id)