-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Abeshouse, Adam A./Sloan Kettering Institute <abeshoua@mskcc.org>
- Loading branch information
Abeshouse, Adam A./Sloan Kettering Institute
committed
Aug 15, 2018
1 parent
af53431
commit 48633b5
Showing
2 changed files
with
50 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {assert} from "chai"; | ||
import {makeScatterPlotData} from "./PlotsTabUtils"; | ||
import {Sample} from "../../../shared/api/generated/CBioPortalAPI"; | ||
|
||
describe("PlotsTabUtils", ()=>{ | ||
describe("makeScatterPlotData", ()=>{ | ||
it ("does not create data for NaN values", ()=>{ | ||
const data = makeScatterPlotData( | ||
{ | ||
datatype:"number", | ||
data:[ | ||
{ uniqueSampleKey:"sample1", value:NaN}, { uniqueSampleKey:"sample2", value:3}, | ||
{ uniqueSampleKey:"sample3", value:1} | ||
], | ||
}, | ||
{ | ||
datatype:"number", | ||
data:[ | ||
{ uniqueSampleKey:"sample1", value:0}, { uniqueSampleKey:"sample2", value:NaN}, | ||
{ uniqueSampleKey:"sample3", value:4} | ||
], | ||
}, | ||
{ sample1: {sampleId:"sample1", studyId:"study"} as Sample, | ||
sample2: {sampleId:"sample2", studyId:"study"} as Sample, | ||
sample3: {sampleId:"sample3", studyId:"study"} as Sample | ||
}, | ||
{} | ||
); | ||
assert.equal(data.length, 1, "only one datum - others have NaN"); | ||
const datum:any = data[0]; | ||
const target:any = { | ||
uniqueSampleKey:"sample3", | ||
sampleId:"sample3", | ||
studyId:"study", | ||
x:1, | ||
y:4, | ||
}; | ||
for (const key of ["uniqueSampleKey", "sampleId", "studyId", "x", "y"]) { | ||
assert.equal(target[key], datum[key], key); | ||
} | ||
}); | ||
}); | ||
}); |
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