From cbf7938ed738cb441822751736dced3a18850995 Mon Sep 17 00:00:00 2001 From: Danny Date: Wed, 9 Nov 2022 13:27:50 +0300 Subject: [PATCH] Fixed the test issue --- src/core/domain/dtos/elastic/es-multimatch.dto.ts | 4 +--- src/test/search.service.spec.ts | 13 ++++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/core/domain/dtos/elastic/es-multimatch.dto.ts b/src/core/domain/dtos/elastic/es-multimatch.dto.ts index 6617fea..81295d0 100644 --- a/src/core/domain/dtos/elastic/es-multimatch.dto.ts +++ b/src/core/domain/dtos/elastic/es-multimatch.dto.ts @@ -1,7 +1,5 @@ import { ApiExtraModels, ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"; -import { IsArray, IsDefined, IsInt, IsObject, IsOptional } from "class-validator"; -import { EsPit } from "../../interfaces/elastic/es-pit.interface"; -import { EsQuery } from "../../interfaces/elastic/es-query.interface" +import { IsDefined, IsInt, IsObject, IsOptional } from "class-validator"; /** * List of allowed properties in this DTO diff --git a/src/test/search.service.spec.ts b/src/test/search.service.spec.ts index 2fa1197..76bc66a 100644 --- a/src/test/search.service.spec.ts +++ b/src/test/search.service.spec.ts @@ -107,13 +107,16 @@ describe('Unit tests for SearchService', () => { expect(httpGetSpy).toHaveBeenCalledWith<[string, object]>(expect.anything(), { data: { query: { - query_string: { - query: 'keyword', - default_field: 'content', + multi_match: { + query: query.query, + fields: [ + 'title', + 'content' + ] } }, - from: 32, - size: 1, + from: query.offset, + size: query.limit }, headers: { 'Content-Type': 'application/json' } });