From fb898ba614bfe02e7ce71e957355b5b094fa3b5a Mon Sep 17 00:00:00 2001 From: Roman Kalyakin Date: Mon, 24 May 2021 14:19:33 +0200 Subject: [PATCH] fixed tests --- test/services/entities-mentions.test.js | 37 +++++++++++++------------ 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/test/services/entities-mentions.test.js b/test/services/entities-mentions.test.js index 4e4569c6..117ca856 100644 --- a/test/services/entities-mentions.test.js +++ b/test/services/entities-mentions.test.js @@ -1,25 +1,28 @@ -const assert = require('assert'); -const { buildSolrQuery } = require('../../src/services/entities-mentions/entities-mentions.class'); +const assert = require("assert"); +const { + buildSolrQuery, +} = require("../../src/services/entities-mentions/entities-mentions.class"); -describe('\'entities-mentions\' service', () => { - it('builds Solr query', () => { +describe("'entities-mentions' service", () => { + it("builds Solr query", () => { const filters = [ { - type: 'string', - q: ['Jacque Chira'], + type: "string", + q: ["Jacque Chira"], }, { - type: 'mentionFunction', - q: 'ministre', + type: "mentionFunction", + q: "ministre", }, ]; const query = buildSolrQuery(filters); const expectedQuery = { - query: '((m_name_s:Jacque AND m_name_s:Chira*) OR (e_master_label:Jacque AND e_master_label:Chira*)) AND filter(m_function_s:ministre)', + query: + "((mentionSuggest:Jacque AND mentionSuggest:Chira*) OR (entitySuggest:Jacque AND entitySuggest:Chira*)) AND filter(m_function_s:ministre)", params: { group: true, - 'group.field': 'e_id_s', - 'group.format': 'simple', + "group.field": "e_id_s", + "group.format": "simple", rows: 10, start: 0, }, @@ -28,20 +31,20 @@ describe('\'entities-mentions\' service', () => { assert.deepStrictEqual(query, expectedQuery); }); - it('builds simple Solr query', () => { + it("builds simple Solr query", () => { const filters = [ { - type: 'string', - q: 'Chira', + type: "string", + q: "Chira", }, ]; const query = buildSolrQuery(filters, 5, 10); const expectedQuery = { - query: '(m_name_s:Chira* OR e_master_label:Chira*)', + query: "(mentionSuggest:Chira* OR entitySuggest:Chira*)", params: { group: true, - 'group.field': 'e_id_s', - 'group.format': 'simple', + "group.field": "e_id_s", + "group.format": "simple", rows: 5, start: 10, },