Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
theorm committed Jul 11, 2024
1 parent e9e8b91 commit fb898ba
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions test/services/entities-mentions.test.js
Original file line number Diff line number Diff line change
@@ -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,
},
Expand All @@ -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,
},
Expand Down

0 comments on commit fb898ba

Please sign in to comment.