mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-11 04:30:57 +08:00
Fix unit tests (#2428)
* only create toaster if we're on the browser * drop/fix references to window * add back fe unit tests
This commit is contained in:
@@ -68,7 +68,7 @@ jobs:
|
|||||||
run: make pydist install-dist dev-env-server
|
run: make pydist install-dist dev-env-server
|
||||||
- name: Unit tests
|
- name: Unit tests
|
||||||
run: |
|
run: |
|
||||||
make unit-test-server
|
make unit-test-server unit-test-client
|
||||||
bash <(curl -s https://codecov.io/bash) -y .codecov.yml -k backend/server -cF backend,python,unitTest
|
bash <(curl -s https://codecov.io/bash) -y .codecov.yml -k backend/server -cF backend,python,unitTest
|
||||||
cd client && ./node_modules/codecov/bin/codecov --yml=../.codecov.yml --root=../ --gcov-root=../ -C -F frontend,javascript,unitTest
|
cd client && ./node_modules/codecov/bin/codecov --yml=../.codecov.yml --root=../ --gcov-root=../ -C -F frontend,javascript,unitTest
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,4 @@
|
|||||||
export const baseDataURL = "https://a.fake.url/api/v0.2";
|
export const baseDataURL = "https://a.fake.url/api/v0.2";
|
||||||
|
|
||||||
window.CELLXGENE = {
|
|
||||||
API: {
|
|
||||||
prefix: baseDataURL,
|
|
||||||
version: "v0.2/",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export { schema } from "./schema";
|
export { schema } from "./schema";
|
||||||
export * from "./routes";
|
export * from "./routes";
|
||||||
|
|||||||
@@ -1,31 +1,33 @@
|
|||||||
import { Position, Toaster, Intent } from "@blueprintjs/core";
|
import { Position, Toaster, Intent } from "@blueprintjs/core";
|
||||||
|
|
||||||
/** Singleton toaster instance. Create separate instances for different options. */
|
/** Singleton toaster instance. Create separate instances for different options. */
|
||||||
|
let ToastTopCenter = null;
|
||||||
const ToastTopCenter = Toaster.create({
|
if (typeof document !== "undefined") {
|
||||||
|
ToastTopCenter = Toaster.create({
|
||||||
className: "recipe-toaster",
|
className: "recipe-toaster",
|
||||||
position: Position.TOP,
|
position: Position.TOP,
|
||||||
maxToasts: 4,
|
maxToasts: 4,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
A "user" error - eg, bad input
|
A "user" error - eg, bad input
|
||||||
*/
|
*/
|
||||||
export const postUserErrorToast = (message) =>
|
export const postUserErrorToast = (message) =>
|
||||||
ToastTopCenter.show({ message, intent: Intent.WARNING });
|
ToastTopCenter?.show({ message, intent: Intent.WARNING });
|
||||||
|
|
||||||
/*
|
/*
|
||||||
A toast the user must dismiss manually, because they need to act on its information,
|
A toast the user must dismiss manually, because they need to act on its information,
|
||||||
ie., 8 bulk add genes out of 40 were bad. Manually see which ones and fix.
|
ie., 8 bulk add genes out of 40 were bad. Manually see which ones and fix.
|
||||||
*/
|
*/
|
||||||
export const keepAroundErrorToast = (message) =>
|
export const keepAroundErrorToast = (message) =>
|
||||||
ToastTopCenter.show({ message, timeout: 0, intent: Intent.WARNING });
|
ToastTopCenter?.show({ message, timeout: 0, intent: Intent.WARNING });
|
||||||
|
|
||||||
/*
|
/*
|
||||||
a hard network error
|
a hard network error
|
||||||
*/
|
*/
|
||||||
export const postNetworkErrorToast = (message, key = undefined) =>
|
export const postNetworkErrorToast = (message, key = undefined) =>
|
||||||
ToastTopCenter.show(
|
ToastTopCenter?.show(
|
||||||
{
|
{
|
||||||
message,
|
message,
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
@@ -38,14 +40,14 @@ export const postNetworkErrorToast = (message, key = undefined) =>
|
|||||||
Async message to user
|
Async message to user
|
||||||
*/
|
*/
|
||||||
export const postAsyncSuccessToast = (message) =>
|
export const postAsyncSuccessToast = (message) =>
|
||||||
ToastTopCenter.show({
|
ToastTopCenter?.show({
|
||||||
message,
|
message,
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const postAsyncFailureToast = (message) =>
|
export const postAsyncFailureToast = (message) =>
|
||||||
ToastTopCenter.show({
|
ToastTopCenter?.show({
|
||||||
message,
|
message,
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
intent: Intent.WARNING,
|
intent: Intent.WARNING,
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ const CXG_SERVER_PORT =
|
|||||||
|
|
||||||
let _API;
|
let _API;
|
||||||
|
|
||||||
if (window.CELLXGENE && window.CELLXGENE.API) {
|
if (typeof window !== "undefined" && window.CELLXGENE && window.CELLXGENE.API) {
|
||||||
_API = window.CELLXGENE.API;
|
_API = window.CELLXGENE.API;
|
||||||
} else {
|
} else {
|
||||||
if (CXG_SERVER_PORT === undefined) {
|
if (CXG_SERVER_PORT === undefined) {
|
||||||
|
|||||||
Reference in New Issue
Block a user