mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-07 19:18:11 +08:00
Fix jest test suites (#268)
* CRLF to LF * add babel-jest * use ES6 style imports * fix bugs manifest by test suite * add babel test config
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
// jshint esversion: 6
|
// jshint esversion: 6
|
||||||
|
|
||||||
const BitArray = require("../../src/util/typedCrossfilter/bitArray");
|
import BitArray from "../../src/util/typedCrossfilter/bitArray";
|
||||||
|
|
||||||
const defaultTestLength = 8;
|
const defaultTestLength = 8;
|
||||||
|
|
||||||
describe("default select state", () => {
|
describe("default select state", () => {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// jshint esversion: 6
|
// jshint esversion: 6
|
||||||
|
|
||||||
const PositiveIntervals = require("../../src/util/typedCrossfilter/positiveIntervals");
|
// const PositiveIntervals = require("../../src/util/typedCrossfilter/positiveIntervals");
|
||||||
|
import PositiveIntervals from "../../src/util/typedCrossfilter/positiveIntervals";
|
||||||
|
|
||||||
describe("canonicalize", () => {
|
describe("canonicalize", () => {
|
||||||
test("empty", () => {
|
test("empty", () => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// jshint esversion: 6
|
// jshint esversion: 6
|
||||||
const _ = require("lodash");
|
import _ from "lodash";
|
||||||
const crossfilter = require("../../src/util/typedCrossfilter");
|
import crossfilter from "../../src/util/typedCrossfilter";
|
||||||
|
|
||||||
const someData = [
|
const someData = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
"autoprefixer": "^9.1.1",
|
"autoprefixer": "^9.1.1",
|
||||||
"babel-core": "^6.13.2",
|
"babel-core": "^6.13.2",
|
||||||
"babel-eslint": "^8.2.6",
|
"babel-eslint": "^8.2.6",
|
||||||
|
"babel-jest": "^23.6.0",
|
||||||
"babel-loader": "^7.1.2",
|
"babel-loader": "^7.1.2",
|
||||||
"babel-plugin-istanbul": "^4.1.6",
|
"babel-plugin-istanbul": "^4.1.6",
|
||||||
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
||||||
@@ -105,5 +106,17 @@
|
|||||||
"**/__tests__/**/?(*.)(spec|test).js?(x)"
|
"**/__tests__/**/?(*.)(spec|test).js?(x)"
|
||||||
],
|
],
|
||||||
"testURL": "http://localhost/"
|
"testURL": "http://localhost/"
|
||||||
|
},
|
||||||
|
"babel": {
|
||||||
|
"env": {
|
||||||
|
"test": {
|
||||||
|
"presets": [
|
||||||
|
[
|
||||||
|
"env"
|
||||||
|
],
|
||||||
|
"react"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -401,7 +401,11 @@ class ScalarGroup {
|
|||||||
this.dimension = dimension;
|
this.dimension = dimension;
|
||||||
|
|
||||||
// generate group names from dimension values
|
// generate group names from dimension values
|
||||||
this.mapValue = this._map(groupValue, groupValueType, dimension);
|
this.mapValue = this.constructor._map(
|
||||||
|
groupValue,
|
||||||
|
groupValueType,
|
||||||
|
dimension
|
||||||
|
);
|
||||||
|
|
||||||
// group index is mapping from data record index to group index
|
// group index is mapping from data record index to group index
|
||||||
this.groupIndex = new Uint32Array(dimension.crossfilter.data.length);
|
this.groupIndex = new Uint32Array(dimension.crossfilter.data.length);
|
||||||
@@ -469,7 +473,7 @@ class ScalarGroup {
|
|||||||
|
|
||||||
// Each item in the range will be remved from `dim`. reduceRemove if it
|
// Each item in the range will be remved from `dim`. reduceRemove if it
|
||||||
// is currently selected.
|
// is currently selected.
|
||||||
const { data, selection } = this.dimension.crossfilter.selection;
|
const { data, selection } = this.dimension.crossfilter;
|
||||||
intv.forEach(rng => {
|
intv.forEach(rng => {
|
||||||
for (let r = rng[0]; r < rng[1]; r += 1) {
|
for (let r = rng[0]; r < rng[1]; r += 1) {
|
||||||
const i = dim.index[r];
|
const i = dim.index[r];
|
||||||
|
|||||||
Reference in New Issue
Block a user