Skip to content

Commit 0c08017

Browse files
committed
feat(meilisearch-connector): modify addEntriesToMeilisearch to return an array of tasks
1 parent d4c6a37 commit 0c08017

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

server/__tests__/meilisearch.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ describe('Tests content types', () => {
110110
)
111111
expect(client.index('').addDocuments).toHaveBeenCalledTimes(1)
112112
expect(client.index).toHaveBeenCalledWith('customIndex')
113-
expect(tasks).toEqual(10)
113+
expect(tasks).toEqual([10])
114114
})
115115

116116
test('Test to add entries linked to multiple indexes in Meilisearch', async () => {
@@ -199,7 +199,7 @@ describe('Tests content types', () => {
199199
expect(client.index('').addDocuments).toHaveBeenCalledTimes(2)
200200
expect(client.index).toHaveBeenCalledWith('customIndex')
201201
expect(client.index).toHaveBeenCalledWith('anotherIndex')
202-
expect(tasks).toEqual(10)
202+
expect(tasks).toEqual([10, 10])
203203
})
204204

205205
test('Test to delete entries from Meilisearch', async () => {

server/services/meilisearch/connector.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ module.exports = ({ strapi, adapter, config }) => {
269269
* @param {object} options
270270
* @param {string} options.contentType - ContentType name.
271271
* @param {object[] | object} options.entries - Entry from the document.
272-
* @returns {Promise<{ taskUid: number }>} - Task identifier.
272+
* @returns {Promise<{ taskUid: number }[]>} - Task identifiers.
273273
*/
274274
addEntriesToMeilisearch: async function ({ contentType, entries }) {
275275
const { apiKey, host } = await store.getCredentials()
@@ -300,7 +300,7 @@ module.exports = ({ strapi, adapter, config }) => {
300300
}),
301301
)
302302

303-
return tasks.flat()[0]
303+
return tasks.flat()
304304
},
305305

306306
/**

0 commit comments

Comments
 (0)