fix: bulk publish (#6006)
This commit is contained in:
@@ -437,6 +437,7 @@ describe('Versions', () => {
|
||||
collection,
|
||||
data: {
|
||||
title: patchedTitle,
|
||||
_status: 'draft',
|
||||
},
|
||||
draft: true,
|
||||
locale: 'en',
|
||||
@@ -450,6 +451,7 @@ describe('Versions', () => {
|
||||
collection,
|
||||
data: {
|
||||
title: spanishTitle,
|
||||
_status: 'draft',
|
||||
},
|
||||
draft: true,
|
||||
locale: 'es',
|
||||
@@ -529,9 +531,11 @@ describe('Versions', () => {
|
||||
},
|
||||
})
|
||||
|
||||
// bulk publish
|
||||
const updated = await payload.update({
|
||||
collection: draftCollectionSlug,
|
||||
data: {
|
||||
_status: 'published',
|
||||
description: 'updated description',
|
||||
},
|
||||
draft: true,
|
||||
@@ -544,8 +548,20 @@ describe('Versions', () => {
|
||||
|
||||
const updatedDoc = updated.docs?.[0]
|
||||
|
||||
// get the published doc
|
||||
const findResult = await payload.find({
|
||||
collection: draftCollectionSlug,
|
||||
where: {
|
||||
id: { equals: doc.id },
|
||||
},
|
||||
})
|
||||
|
||||
const findDoc = findResult.docs?.[0]
|
||||
|
||||
expect(updatedDoc.description).toStrictEqual('updated description')
|
||||
expect(updatedDoc.title).toStrictEqual('updated title') // probably will fail
|
||||
expect(updatedDoc.title).toStrictEqual('updated title')
|
||||
expect(findDoc.title).toStrictEqual('updated title')
|
||||
expect(findDoc.description).toStrictEqual('updated description')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1236,6 +1252,7 @@ describe('Versions', () => {
|
||||
await payload.updateGlobal({
|
||||
slug: globalSlug,
|
||||
data: {
|
||||
_status: 'draft',
|
||||
title: updatedTitle2,
|
||||
},
|
||||
draft: true,
|
||||
@@ -1245,6 +1262,7 @@ describe('Versions', () => {
|
||||
await payload.updateGlobal({
|
||||
slug: globalSlug,
|
||||
data: {
|
||||
_status: 'draft',
|
||||
title: updatedTitle2,
|
||||
},
|
||||
draft: true,
|
||||
|
||||
Reference in New Issue
Block a user