feat: re-adapt unit tests for schema change

This commit is contained in:
Mohamed Marrouchi 2025-03-24 10:12:40 +01:00
parent c2670feea3
commit 67c4bc753f
3 changed files with 12 additions and 3 deletions

View File

@ -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: * 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. * 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: [], expressions: [],
builtin: false, builtin: false,
entity: priceValueEntity!.id, entity: priceValueEntity!.id,
doc: '',
}; };
const textSample = { const textSample = {
text: 'How much does a BMW cost?', text: 'How much does a BMW cost?',

View File

@ -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: * 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. * 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'], expressions: ['synonym1', 'synonym2'],
metadata: { firstkey: 'firstvalue', secondKey: 1995 }, metadata: { firstkey: 'firstvalue', secondKey: 1995 },
builtin: false, builtin: false,
doc: '',
}; };
const result = await nlpValueController.create(value); const result = await nlpValueController.create(value);
expect(result).toEqualPayload(value); expect(result).toEqualPayload(value);
@ -223,6 +224,7 @@ describe('NlpValueController', () => {
value: 'updated', value: 'updated',
expressions: [], expressions: [],
builtin: true, builtin: true,
doc: '',
}; };
const result = await nlpValueController.updateOne( const result = await nlpValueController.updateOne(
positiveValue!.id, positiveValue!.id,
@ -241,6 +243,7 @@ describe('NlpValueController', () => {
value: 'updated', value: 'updated',
expressions: [], expressions: [],
builtin: true, builtin: true,
doc: '',
}), }),
).rejects.toThrow(getUpdateOneError(NlpValue.name, jhonNlpValue!.id)); ).rejects.toThrow(getUpdateOneError(NlpValue.name, jhonNlpValue!.id));
}); });

View File

@ -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: * 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. * 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', value: 'positive',
expressions: [], expressions: [],
builtin: true, builtin: true,
doc: '',
}, },
{ {
entity: '0', entity: '0',
value: 'negative', value: 'negative',
expressions: [], expressions: [],
builtin: true, builtin: true,
doc: '',
}, },
{ {
entity: '1', entity: '1',
value: 'jhon', value: 'jhon',
expressions: ['john', 'joohn', 'jhonny'], expressions: ['john', 'joohn', 'jhonny'],
builtin: true, builtin: true,
doc: '',
}, },
{ {
entity: '0', entity: '0',
value: 'greeting', value: 'greeting',
expressions: ['heello', 'Hello', 'hi', 'heyy'], expressions: ['heello', 'Hello', 'hi', 'heyy'],
builtin: true, builtin: true,
doc: '',
}, },
{ {
entity: '0', entity: '0',
value: 'goodbye', value: 'goodbye',
expressions: ['bye', 'bye bye'], expressions: ['bye', 'bye bye'],
builtin: true, builtin: true,
doc: '',
}, },
]; ];