-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add unit test for ScatterplotGraph and CFDRenderer
- Loading branch information
1 parent
844a96f
commit d048e34
Showing
10 changed files
with
147 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import CFDGraph from '../../../src/graphs/cfd/CFDGraph.js'; | ||
import graphsTestData from '../../testData/GraphTestData.js'; | ||
import cfdGraphOutput from '../../testData/CFDGraphExpectedOutput.js'; | ||
|
||
describe('CFDGraph', () => { | ||
let cfdGraph; | ||
|
||
test('computes dataset correctly', () => { | ||
cfdGraph = new CFDGraph(graphsTestData); | ||
const dataSet = cfdGraph.computeDataSet(); | ||
expect(JSON.stringify(dataSet)).toEqual(JSON.stringify(cfdGraphOutput)); | ||
}); | ||
|
||
test('empty data computes to empty dataset', () => { | ||
cfdGraph = new CFDGraph([]); | ||
const dataSet = cfdGraph.computeDataSet(); | ||
expect(dataSet).toEqual([]); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import CFDRenderer from '../../../src/graphs/cfd/CFDRenderer.js'; | ||
import cfdGraphOutput from '../../testData/CFDGraphExpectedOutput.js'; | ||
import metricsOutput from '../../testData/CFDRendererExpectedOutput.js'; | ||
|
||
describe('CFDRenderer', () => { | ||
let cfdRenderer; | ||
|
||
test('computes metrics correctly', () => { | ||
cfdRenderer = new CFDRenderer(cfdGraphOutput); | ||
const date = new Date("2023-04-07T21:00:00.000Z") | ||
const cumulativeCount = 6 | ||
const metrics = cfdRenderer.computeMetrics(date,cumulativeCount); | ||
expect(JSON.stringify(metrics)).toEqual(JSON.stringify(metricsOutput)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import ScatterplotGraph from '../../../src/graphs/scatterplot/ScatterplotGraph.js'; | ||
import graphsTestData from '../../testData/GraphTestData.js'; | ||
import scatterplotGraphOutput from '../../testData/ScatterplotGraphExpectedOutput.js'; | ||
|
||
describe('ScatterplotGraph', () => { | ||
let scatterplotGraph; | ||
|
||
test('computes dataset correctly', () => { | ||
scatterplotGraph = new ScatterplotGraph(graphsTestData); | ||
const dataSet = scatterplotGraph.computeDataSet(); | ||
console.log(JSON.stringify(dataSet)) | ||
expect(JSON.stringify(dataSet)).toEqual(JSON.stringify(scatterplotGraphOutput)); | ||
}); | ||
|
||
test('empty data computes to empty dataset', () => { | ||
scatterplotGraph = new ScatterplotGraph([]); | ||
const dataSet = scatterplotGraph.computeDataSet(); | ||
expect(dataSet).toEqual([]); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const metricsOutput = { | ||
"currentState": "delivered", | ||
"cycleTimeDateBefore": "April 7, 2023", | ||
"leadTimeDateBefore": "April 6, 2023", | ||
"wip": -6, | ||
"averageCycleTime": 1, | ||
"averageLeadTime": 2, | ||
"throughput": -3, | ||
"metricLinesData": { | ||
"averageCycleTime": 1, | ||
"averageLeadTime": 2, | ||
"leadTimeDateBefore": "2023-04-05T21:00:00.000Z", | ||
"cycleTimeDateBefore": "2023-04-06T21:00:00.000Z", | ||
"currentDate": "2023-04-07T21:00:00.000Z", | ||
"currentStateCumulativeCount": 6, | ||
"currentDataEntry": { | ||
"date": "2023-04-07T21:00:00.000Z", | ||
"analysis_active": 0, | ||
"analysis_done": 0, | ||
"in_progress": 1, | ||
"dev_complete": 0, | ||
"verification_start": 0, | ||
"delivered": 5 | ||
} | ||
} | ||
} | ||
|
||
export default metricsOutput |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const scatterplotGraphOutput = [ | ||
{ | ||
"delivered": "2023-03-20T22:00:00.000Z", | ||
"noOfDays": 42, | ||
"ticketId": "TRON-13136" | ||
}, | ||
{ | ||
"delivered": "2023-04-03T21:00:00.000Z", | ||
"noOfDays": 4, | ||
"ticketId": "TRON-13806" | ||
}, | ||
{ | ||
"delivered": "2023-04-03T21:00:00.000Z", | ||
"noOfDays": 0, | ||
"ticketId": "TRON-13847" | ||
}, | ||
{ | ||
"delivered": "2023-04-04T21:00:00.000Z", | ||
"noOfDays": 1, | ||
"ticketId": "TRON-13832" | ||
}, | ||
{ | ||
"delivered": "2023-04-05T21:00:00.000Z", | ||
"noOfDays": 0, | ||
"ticketId": "TRON-13873" | ||
}, | ||
{ | ||
"delivered": "2023-04-13T21:00:00.000Z", | ||
"noOfDays": 7, | ||
"ticketId": "TRON-12964" | ||
} | ||
] | ||
export default scatterplotGraphOutput; |