diff --git a/package.json b/package.json index 652486b..0cd76ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "apisearch", - "version": "0.2.6", + "version": "0.2.7", "description": "Javascript client for Apisearch.", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/Query/Query.ts b/src/Query/Query.ts index 0358622..582d9f5 100644 --- a/src/Query/Query.ts +++ b/src/Query/Query.ts @@ -1182,7 +1182,7 @@ export class Query { for (const i in this.itemsPromoted) { array .items_promoted - .push(this.itemsPromoted[i].toArray); + .push(this.itemsPromoted[i].toArray()); } } diff --git a/test/Query/Query.test.ts b/test/Query/Query.test.ts index 8665b81..1cbca58 100644 --- a/test/Query/Query.test.ts +++ b/test/Query/Query.test.ts @@ -330,6 +330,23 @@ describe('Query()', () => { type: 'marvel' }); }); + + it('should work properly when doing toArray', () => { + // Promote thi two uuids into an existing array from the last test + query.promoteUUIDs( + new ItemUUID('ironman', 'marvel'), + new ItemUUID('thor', 'marvel') + ); + expect(query.toArray().items_promoted.length).to.equal(2); + expect(query.toArray().items_promoted[0]).to.deep.equal({ + id: 'ironman', + type: 'marvel' + }); + expect(query.toArray().items_promoted[1]).to.deep.equal({ + id: 'thor', + type: 'marvel' + }); + }); }); describe('-> When excluding uuids', () => {