diff --git a/.github/workflows/push_tests.yml b/.github/workflows/push_tests.yml index 6887f5e9..cc3e39d6 100644 --- a/.github/workflows/push_tests.yml +++ b/.github/workflows/push_tests.yml @@ -68,7 +68,7 @@ jobs: run: make pydist install-dist dev-env-server - name: Unit tests 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 cd client && ./node_modules/codecov/bin/codecov --yml=../.codecov.yml --root=../ --gcov-root=../ -C -F frontend,javascript,unitTest diff --git a/client/__tests__/util/annoMatrix/serverMocks/index.js b/client/__tests__/util/annoMatrix/serverMocks/index.js index a8ef1285..bc5dd635 100644 --- a/client/__tests__/util/annoMatrix/serverMocks/index.js +++ b/client/__tests__/util/annoMatrix/serverMocks/index.js @@ -1,11 +1,4 @@ export const baseDataURL = "https://a.fake.url/api/v0.2"; -window.CELLXGENE = { - API: { - prefix: baseDataURL, - version: "v0.2/", - }, -}; - export { schema } from "./schema"; export * from "./routes"; diff --git a/client/src/components/framework/toasters.js b/client/src/components/framework/toasters.js index 29e15cdf..17f00baf 100644 --- a/client/src/components/framework/toasters.js +++ b/client/src/components/framework/toasters.js @@ -1,31 +1,33 @@ import { Position, Toaster, Intent } from "@blueprintjs/core"; /** Singleton toaster instance. Create separate instances for different options. */ - -const ToastTopCenter = Toaster.create({ - className: "recipe-toaster", - position: Position.TOP, - maxToasts: 4, -}); +let ToastTopCenter = null; +if (typeof document !== "undefined") { + ToastTopCenter = Toaster.create({ + className: "recipe-toaster", + position: Position.TOP, + maxToasts: 4, + }); +} /* A "user" error - eg, bad input */ 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, ie., 8 bulk add genes out of 40 were bad. Manually see which ones and fix. */ export const keepAroundErrorToast = (message) => - ToastTopCenter.show({ message, timeout: 0, intent: Intent.WARNING }); + ToastTopCenter?.show({ message, timeout: 0, intent: Intent.WARNING }); /* a hard network error */ export const postNetworkErrorToast = (message, key = undefined) => - ToastTopCenter.show( + ToastTopCenter?.show( { message, timeout: 30000, @@ -38,14 +40,14 @@ export const postNetworkErrorToast = (message, key = undefined) => Async message to user */ export const postAsyncSuccessToast = (message) => - ToastTopCenter.show({ + ToastTopCenter?.show({ message, timeout: 10000, intent: Intent.SUCCESS, }); export const postAsyncFailureToast = (message) => - ToastTopCenter.show({ + ToastTopCenter?.show({ message, timeout: 10000, intent: Intent.WARNING, diff --git a/client/src/globals.js b/client/src/globals.js index ec1ee269..05845540 100644 --- a/client/src/globals.js +++ b/client/src/globals.js @@ -102,7 +102,7 @@ const CXG_SERVER_PORT = let _API; -if (window.CELLXGENE && window.CELLXGENE.API) { +if (typeof window !== "undefined" && window.CELLXGENE && window.CELLXGENE.API) { _API = window.CELLXGENE.API; } else { if (CXG_SERVER_PORT === undefined) {