Skip to content
Snippets Groups Projects
Commit f91183c4 authored by Marcos Pieras's avatar Marcos Pieras
Browse files

test: wip

parent 816fd798
No related branches found
No related tags found
No related merge requests found
Pipeline #147370 passed
......@@ -147,6 +147,23 @@ export const insightProcessor = async (frontendPublisher: RabbitMqBroker) => {
html = await populateTemplate(html, result, visualizations);
if (html == 'No valid Template inputs') {
if (ENV == 'develop') {
const message: WsMessageBackend2Frontend = {
type: wsReturnKey.error,
callID: headers.callID,
status: 'success',
value: 'Html no valid',
};
frontendPublisher.publishMessageToFrontend(message, headers.routingKey, headers);
}
log.error('Html is not valid');
return;
}
for (const recipient of insight.recipients) {
if (mail == null) {
log.warn('Mail is not configured. Insight processor will be disabled');
......
......@@ -51,4 +51,20 @@ describe('populateTemplate', () => {
expect(result).toBe(expectedOutput);
});
it('should replace visualization variables correctly', async () => {
const template = 'The mean value is {{ statistic:NodeTypeA • age • average }}.';
const expectedOutput = 'The mean value is 42 .';
const result = await populateTemplate(template, mockResult, []);
expect(result).toBe(expectedOutput);
});
it('should handle wrong input parameters', async () => {
const template = '';
const expectedOutput = 'Html no valid';
const result = await populateTemplate(template, mockResult, []);
expect(result).toBe(expectedOutput);
});
});
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment