prodap-chatbot-domain
Version:
Classes utilizadas na resposta de todas as Intents do Assistente Virtual
151 lines • 5.03 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.graficoLinhaDotLabel = exports.graficoLinhaLimiteY = exports.graficoLinhaTitulo = exports.graficoLinha = void 0;
const index_1 = require("../../../../index");
const DataTypes_1 = require("../../../types/DataTypes");
const graficoLinha = () => {
let result = new index_1.Dialog('LineChart');
const props0 = {
buttons: [
new index_1.ButtonNewModal({
text: 'Detalhar informações',
action: new index_1.HttpAction({
label: '',
url: 'https://us-central1-prodap-testes-eds.cloudfunctions.net/intencao_vistoria_lotes_detalhe',
}),
parameters: { dataInicio: '', dataFinal: '' },
content: '',
}),
],
chartProps: {
title: 'Acompanhamento e Vistorias',
subtitle: 'subtitulo',
chartText: '% de itens acompanhados nos últimos 7 dias',
legendTitle: 'TOTAL: 29 Lotes',
showLegend: true,
dataType: DataTypes_1.default.NUMBER,
},
titleAxisX: 'Titulo eixo x',
titleAxisY: 'Titulo eixo y',
};
result.add(new index_1.LineChart(props0)
.addData([
{
label: 'Aguada',
value: 33,
hasCollect: true,
},
{
label: 'Rebanho',
value: 6,
hasCollect: true,
},
{
label: 'Altura Pasto',
value: 33,
hasCollect: true,
},
])
.addAction(new index_1.HttpAction({ label: 'Detalhar informações', url: 'https://action.detail.bar' })));
expect(result.messages.length).toBe(1);
let chat = result.messages[0];
expect(chat.data.length).toBe(1);
expect(chat.actions.length).toBe(1);
result = new index_1.Dialog('chart-intent');
const props1 = {
chartProps: {
title: 'Acompanhamento e Vistorias',
subtitle: 'subtitulo',
showLegend: true,
dataType: DataTypes_1.default.NUMBER,
},
titleAxisX: 'Titulo eixo x',
titleAxisY: 'Titulo eixo y',
};
result.add(new index_1.LineChart(props1).addData([
{
label: 'Lotes vistoriados nos ultimos 3 dias: 72% - 33 lotes',
value: 33,
hasCollect: true,
},
]));
expect(result.messages.length).toBe(1);
chat = result.messages[0];
expect(chat.data.length).toBe(1);
expect(chat.actions.length).toBe(0);
};
exports.graficoLinha = graficoLinha;
const graficoLinhaTitulo = () => {
let result = new index_1.Dialog('LineChart');
result = new index_1.Dialog('chart-intent');
const props2 = {
chartProps: {
title: 'Acompanhamento e Vistorias',
},
};
result.add(new index_1.LineChart(props2).addData([
{
label: 'Lotes vistoriados nos ultimos 3 dias: 72% - 33 lotes',
value: 33,
hasCollect: true,
},
]));
expect(result.messages.length).toBe(1);
const chat = result.messages[0];
expect(chat.data.length).toBe(1);
expect(chat.actions.length).toBe(0);
};
exports.graficoLinhaTitulo = graficoLinhaTitulo;
const graficoLinhaLimiteY = () => {
let result = new index_1.Dialog('LineChart');
result = new index_1.Dialog('chart-intent');
const props2 = {
chartProps: {
title: 'Acompanhamento e Vistorias',
},
yMin: 50,
yMax: 120,
};
result.add(new index_1.LineChart(props2).addData([
{
label: 'Lotes vistoriados nos ultimos 3 dias: 72% - 33 lotes',
value: 33,
hasCollect: true,
},
]));
expect(result.messages.length).toBe(1);
const chat = result.messages[0];
expect(chat.data.length).toBe(1);
expect(chat.actions.length).toBe(0);
expect(chat).toHaveProperty('yMin');
expect(chat).toHaveProperty('yMax');
};
exports.graficoLinhaLimiteY = graficoLinhaLimiteY;
const graficoLinhaDotLabel = () => {
let result = new index_1.Dialog('LineChart');
result = new index_1.Dialog('chart-intent');
const props2 = {
chartProps: {
title: 'Acompanhamento e Vistorias',
},
yMin: 50,
yMax: 120,
};
result.add(new index_1.LineChart(props2).addData([
{
label: 'Lotes vistoriados nos ultimos 3 dias: 72% - 33 lotes',
value: 33,
hasCollect: true,
dotLabel: '33',
},
]));
expect(result.messages.length).toBe(1);
const chat = result.messages[0];
expect(chat.data.length).toBe(1);
expect(chat.data[0][0]).toHaveProperty('dotLabel');
expect(chat.actions.length).toBe(0);
expect(chat).toHaveProperty('yMin');
expect(chat).toHaveProperty('yMax');
};
exports.graficoLinhaDotLabel = graficoLinhaDotLabel;
//# sourceMappingURL=LineChart.js.map