Skip to content

Commit 137fe1b

Browse files
Merge pull request #2 from mimartinez/patch-1
Updated meilisearch.test.js file for #1040 fix
2 parents 78dd466 + d136180 commit 137fe1b

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

server/src/__tests__/meilisearch.test.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,12 @@ describe('Tests content types', () => {
9898
},
9999
})
100100

101-
const mockEntry = { attributes: { id: 1 } }
101+
// In Strapi v5 - If Draft & Publish is disabled, publishedAt is set to the latest creation or edition date of the document
102+
// More information: https://docs.strapi.io/cms/migration/v4-to-v5/breaking-changes/publishedat-always-set-when-dandp-disabled
103+
const mockEntry = {
104+
attributes: { id: 1 },
105+
publishedAt: '2022-01-01T00:00:00.000Z',
106+
}
102107
const tasks = await meilisearchService.addEntriesToMeilisearch({
103108
contentType: 'restaurant',
104109
entries: [mockEntry, mockEntry],
@@ -183,7 +188,12 @@ describe('Tests content types', () => {
183188
},
184189
})
185190

186-
const mockEntry = { attributes: { id: 1 } }
191+
// In Strapi v5 - If Draft & Publish is disabled, publishedAt is set to the latest creation or edition date of the document
192+
// More information: https://docs.strapi.io/cms/migration/v4-to-v5/breaking-changes/publishedat-always-set-when-dandp-disabled
193+
const mockEntry = {
194+
attributes: { id: 1 },
195+
publishedAt: '2022-01-01T00:00:00.000Z',
196+
}
187197
const tasks = await meilisearchService.addEntriesToMeilisearch({
188198
contentType: 'restaurant',
189199
entries: [mockEntry, mockEntry],
@@ -345,7 +355,12 @@ describe('Tests content types', () => {
345355
},
346356
})
347357

348-
const mockEntryUpdate = { attributes: { id: 1 } }
358+
// In Strapi v5 - If Draft & Publish is disabled, publishedAt is set to the latest creation or edition date of the document
359+
// More information: https://docs.strapi.io/cms/migration/v4-to-v5/breaking-changes/publishedat-always-set-when-dandp-disabled
360+
const mockEntryUpdate = {
361+
attributes: { id: 1 },
362+
publishedAt: '2022-01-01T00:00:00.000Z',
363+
}
349364

350365
const mockEntryCreate = {
351366
_meilisearch_id: 'restaurant-1',
@@ -579,12 +594,14 @@ describe('Tests content types', () => {
579594
title: 'title',
580595
internal_notes: 'note123',
581596
secret: '123',
597+
publishedAt: '2022-01-01T00:00:00.000Z', // In Strapi v5 - If Draft & Publish is disabled, publishedAt is set to the latest creation or edition date of the document
582598
},
583599
{
584600
id: 2,
585601
title: 'abc',
586602
internal_notes: 'note234',
587603
secret: '234',
604+
publishedAt: '2022-01-01T00:00:00.000Z', // In Strapi v5 - If Draft & Publish is disabled, publishedAt is set to the latest creation or edition date of the document
588605
},
589606
],
590607
contentType,
@@ -634,12 +651,14 @@ describe('Tests content types', () => {
634651
id: 1,
635652
title: 'title',
636653
internal_notes: 'note123',
654+
publishedAt: '2022-01-01T00:00:00.000Z',
637655
},
638656
{
639657
_meilisearch_id: 'restaurant-2',
640658
id: 2,
641659
title: 'abc',
642660
internal_notes: 'note234',
661+
publishedAt: '2022-01-01T00:00:00.000Z',
643662
},
644663
],
645664
{ primaryKey: '_meilisearch_id' },

0 commit comments

Comments
 (0)