79 lines
2.9 KiB
JavaScript
79 lines
2.9 KiB
JavaScript
const assert = require("chai").assert;
|
|
const validaciones = require("../src/core/validaciones");
|
|
const ema = require("../src/core/ema.js");
|
|
|
|
var datosRecolectadosTest = [
|
|
"04/04/2019 00:32:36", // 0 Fecha
|
|
"2019-04-04T00:32:36", // 1 Presion Abs
|
|
25, // 2 Presion Abs
|
|
28.2, // 3 Presion Abs
|
|
78, // 4 Presion Abs
|
|
61, // 5 Presion Abs
|
|
0, // 6 Presion Abs
|
|
1, // 7 Presion Abs
|
|
3, // 8 Presion Abs
|
|
5, // 9 Viento Rafaga
|
|
225, // 10 Viento Direc
|
|
"Sudoeste", // 11 Viento Nombre
|
|
0, // 12 Presion Abs
|
|
1013.2, // 13 Presion rel
|
|
387.3, // 14 Luvia total
|
|
20.89, // 15 Punto de Rocio
|
|
"2019-04-04+20:23:08", // 16 Fecha UTC
|
|
{ // 17 Sensor
|
|
"b1": false,
|
|
"b2": false,
|
|
"b3": false,
|
|
"b4": false,
|
|
"b5": false,
|
|
"lost_sensor_contact": false,
|
|
"rain_overflow": false,
|
|
"b8": false
|
|
}
|
|
];
|
|
|
|
describe("Pruebas unitarias para EMA Libre Carpincho utilizando ASSERT (afirmar): ", function() {
|
|
|
|
describe("Se comprueba el metodo validador de registros: ", function() {
|
|
it("Con datos correctos.", function() {
|
|
Datos = ['validar', datosRecolectadosTest];
|
|
validaciones.Registros(Datos,function (errorvalidador, estadovalidador)
|
|
{
|
|
assert.equal(estadovalidador, true);
|
|
});
|
|
});
|
|
it("Con datos incorrectos(Sin señal RF): ", function() {
|
|
Datos = ['validar', datosRecolectadosTest];
|
|
Datos[1][17].lost_sensor_contact = true;
|
|
validaciones.Registros(Datos,function (errorvalidador, estadovalidador)
|
|
{
|
|
assert.equal(estadovalidador, false);
|
|
});
|
|
});
|
|
});
|
|
describe("Se comprueba el core de EMA: ", function() {
|
|
it("Guardar 2 Registros en el Tanque.", function() {
|
|
ema.Configuracion.TanquePendiente = ['Prueba','Prueba2'];
|
|
ema.Guardar_Pendientes('', false);
|
|
ema.VerificarTanqueDePendientes('Prueba');
|
|
|
|
});
|
|
it("Lee el Tanque.", function() {
|
|
var cant = ema.HayPendientes();
|
|
console.log(cant);
|
|
assert.equal(2, 2);
|
|
|
|
});
|
|
it("Se borra el Tanque.", function() {
|
|
ema.Configuracion.TanquePendiente = [];
|
|
ema.Guardar_Pendientes('', false);
|
|
ema.VerificarTanqueDePendientes('Prueba');
|
|
});
|
|
it("Lee el Tanque Vacio.", function() {
|
|
var cant = ema.HayPendientes();
|
|
console.log(cant);
|
|
assert.equal(cant, 0);
|
|
});
|
|
});
|
|
|
|
}); |