From 67c4bc753f2e660bb5f5ac8cc35a9d4eb944d246 Mon Sep 17 00:00:00 2001 From: Mohamed Marrouchi Date: Mon, 24 Mar 2025 10:12:40 +0100 Subject: [PATCH] feat: re-adapt unit tests for schema change --- api/src/nlp/controllers/nlp-sample.controller.spec.ts | 3 ++- api/src/nlp/controllers/nlp-value.controller.spec.ts | 5 ++++- api/src/utils/test/fixtures/nlpvalue.ts | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/api/src/nlp/controllers/nlp-sample.controller.spec.ts b/api/src/nlp/controllers/nlp-sample.controller.spec.ts index 832e21da..2e82b180 100644 --- a/api/src/nlp/controllers/nlp-sample.controller.spec.ts +++ b/api/src/nlp/controllers/nlp-sample.controller.spec.ts @@ -1,5 +1,5 @@ /* - * Copyright © 2024 Hexastack. All rights reserved. + * Copyright © 2025 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. @@ -379,6 +379,7 @@ describe('NlpSampleController', () => { expressions: [], builtin: false, entity: priceValueEntity!.id, + doc: '', }; const textSample = { text: 'How much does a BMW cost?', diff --git a/api/src/nlp/controllers/nlp-value.controller.spec.ts b/api/src/nlp/controllers/nlp-value.controller.spec.ts index d78b336f..9108cf97 100644 --- a/api/src/nlp/controllers/nlp-value.controller.spec.ts +++ b/api/src/nlp/controllers/nlp-value.controller.spec.ts @@ -1,5 +1,5 @@ /* - * Copyright © 2024 Hexastack. All rights reserved. + * Copyright © 2025 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. @@ -157,6 +157,7 @@ describe('NlpValueController', () => { expressions: ['synonym1', 'synonym2'], metadata: { firstkey: 'firstvalue', secondKey: 1995 }, builtin: false, + doc: '', }; const result = await nlpValueController.create(value); expect(result).toEqualPayload(value); @@ -223,6 +224,7 @@ describe('NlpValueController', () => { value: 'updated', expressions: [], builtin: true, + doc: '', }; const result = await nlpValueController.updateOne( positiveValue!.id, @@ -241,6 +243,7 @@ describe('NlpValueController', () => { value: 'updated', expressions: [], builtin: true, + doc: '', }), ).rejects.toThrow(getUpdateOneError(NlpValue.name, jhonNlpValue!.id)); }); diff --git a/api/src/utils/test/fixtures/nlpvalue.ts b/api/src/utils/test/fixtures/nlpvalue.ts index fa882014..fe8714b6 100644 --- a/api/src/utils/test/fixtures/nlpvalue.ts +++ b/api/src/utils/test/fixtures/nlpvalue.ts @@ -1,5 +1,5 @@ /* - * Copyright © 2024 Hexastack. All rights reserved. + * Copyright © 2025 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. @@ -19,30 +19,35 @@ export const nlpValueFixtures: NlpValueCreateDto[] = [ value: 'positive', expressions: [], builtin: true, + doc: '', }, { entity: '0', value: 'negative', expressions: [], builtin: true, + doc: '', }, { entity: '1', value: 'jhon', expressions: ['john', 'joohn', 'jhonny'], builtin: true, + doc: '', }, { entity: '0', value: 'greeting', expressions: ['heello', 'Hello', 'hi', 'heyy'], builtin: true, + doc: '', }, { entity: '0', value: 'goodbye', expressions: ['bye', 'bye bye'], builtin: true, + doc: '', }, ];