fix tests

This commit is contained in:
Alexander Zobnin
2020-07-21 10:12:56 +03:00
parent ac64a27c28
commit 2bd04e9c22

View File

@@ -43,10 +43,10 @@ describe('TriggerPanelCtrl', () => {
ctx.panelCtrl = createPanelCtrl();
ctx.dataFramesReceived = generateDataFramesResponse([
{id: "1", lastchange: "1510000010", priority: 5},
{id: "2", lastchange: "1510000040", priority: 3},
{id: "3", lastchange: "1510000020", priority: 4},
{id: "4", lastchange: "1510000030", priority: 2},
{id: "1", timestamp: "1510000010", priority: 5},
{id: "2", timestamp: "1510000040", priority: 3},
{id: "3", timestamp: "1510000020", priority: 4},
{id: "4", timestamp: "1510000030", priority: 2},
]);
});
@@ -168,7 +168,7 @@ const defaultProblem: any = {
};
function generateDataFramesResponse(problemDescs: any[] = [{id: 1}]): any {
const problems = problemDescs.map(problem => generateProblem(problem.id, problem.lastchange, problem.priority));
const problems = problemDescs.map(problem => generateProblem(problem.id, problem.timestamp, problem.priority));
return [
{
@@ -193,11 +193,13 @@ function generateDataFramesResponse(problemDescs: any[] = [{id: 1}]): any {
function generateProblem(id, timestamp?, severity?): any {
const problem = _.cloneDeep(defaultProblem);
problem.triggerid = id.toString();
problem.eventid = id.toString();
if (severity) {
problem.priority = severity.toString();
}
if (timestamp) {
problem.lastchange = timestamp;
problem.timestamp = timestamp;
}
return problem;
}