mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-06 12:58:11 +08:00
* Added TS. Updated build and linting config. Added types. * [ts-migrate][.] Rename files from JS/JSX to TS/TSX Co-authored-by: ts-migrate <> * [ts-migrate][.] Run TS Migrate Co-authored-by: ts-migrate <> * Corrected files mangled by ts-migrate. * Updated lint config, minor linting. * Re-enabled Husky. * Updated tests and config. * Reverted webpack devtool config. * Removed obsolete snapshots. * Added annotations snap. * Updated tsconfig includes wrt linting. * Removed ts-migrate. Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com>
This commit is contained in:
co-authored by
ts-migrate
Timmy Huang
parent
7328cbdbd5
commit
934cc5c69b
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
Test cases for nameCreators.js.
|
||||
*/
|
||||
import {
|
||||
layoutDimensionName,
|
||||
obsAnnoDimensionName,
|
||||
diffexpDimensionName,
|
||||
userDefinedDimensionName,
|
||||
makeContinuousDimensionName,
|
||||
} from "../../src/util/nameCreators";
|
||||
|
||||
describe("nameCreators", () => {
|
||||
const nameCreators = [
|
||||
layoutDimensionName,
|
||||
obsAnnoDimensionName,
|
||||
diffexpDimensionName,
|
||||
userDefinedDimensionName,
|
||||
];
|
||||
|
||||
test("check for namespace isolation", () => {
|
||||
const foo = "foo";
|
||||
nameCreators.forEach((fn) => expect(fn(foo)).not.toBe(foo));
|
||||
|
||||
const bar = "bar";
|
||||
nameCreators.forEach((fn) => expect(fn(foo)).not.toBe(fn(bar)));
|
||||
|
||||
nameCreators.forEach((fn) => {
|
||||
const allOtherFn = nameCreators.filter((elmnt) => elmnt !== fn);
|
||||
allOtherFn.forEach((otherFn) => expect(fn(foo)).not.toBe(otherFn(foo)));
|
||||
});
|
||||
});
|
||||
|
||||
test("check for legal keys", () => {
|
||||
/* need namespace creators to return strings only */
|
||||
nameCreators.forEach((fn) => expect(fn("X")).toMatch(/X/));
|
||||
});
|
||||
});
|
||||
|
||||
describe("makeContinuousDimensionName", () => {
|
||||
test("namespaces", () => {
|
||||
expect(makeContinuousDimensionName({ isObs: true }, "OK")).toMatch(/OK/);
|
||||
expect(makeContinuousDimensionName({ isDiffExp: true }, "OK")).toMatch(
|
||||
/OK/
|
||||
);
|
||||
expect(makeContinuousDimensionName({ isUserDefined: true }, "OK")).toMatch(
|
||||
/OK/
|
||||
);
|
||||
});
|
||||
|
||||
test("error handling", () => {
|
||||
expect(() => makeContinuousDimensionName({}, "oops")).toThrow();
|
||||
expect(() =>
|
||||
makeContinuousDimensionName(
|
||||
{ isObs: false, isDiffExp: false, isUserDefined: false },
|
||||
"oops"
|
||||
)
|
||||
).toThrow();
|
||||
expect(() =>
|
||||
makeContinuousDimensionName({ isObs: true }, "OK")
|
||||
).not.toThrow();
|
||||
expect(() =>
|
||||
makeContinuousDimensionName({ isDiffExp: true }, "OK")
|
||||
).not.toThrow();
|
||||
expect(() =>
|
||||
makeContinuousDimensionName({ isUserDefined: true }, "OK")
|
||||
).not.toThrow();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user