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