Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderzobnin committed Jul 21, 2020
1 parent ac64a27 commit 2bd04e9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/panel-triggers/specs/panel_ctrl.spec.ts
Expand Up @@ -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},
]);
});

Expand Down Expand Up @@ -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 [
{
Expand All @@ -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;
}
Expand Down

0 comments on commit 2bd04e9

Please sign in to comment.