Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/src/packages/next/lib/landing/landing.test.ts
Views: 687
/*1* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { toPairs } from "lodash";67import { SOFTWARE_ENV_NAMES } from "@cocalc/util/consts/software-envs";8import { SOFTWARE_FALLBACK, SOFTWARE_URLS } from "./software-data";9import { EnvData } from "./types";1011test("3 known software environments", () => {12expect(SOFTWARE_ENV_NAMES.length).toBe(3);13});1415describe("Download URLs", () => {16it.each(toPairs(SOFTWARE_URLS))("check %s", async (name, url) => {17// TODO: jest can't use fetch? well, we just check the URLs18expect(url.startsWith("https://")).toBe(true);19expect(url.endsWith(`/software-inventory-${name}.json`)).toBe(true);20// const response = await fetch(url);21// expect(response.status).toBe(200);22// const spec = await response.json();23// checkSoftwareSpec(spec as any);24});2526it.each(toPairs(SOFTWARE_FALLBACK))(27"check fallback %s",28(_, fallbackSpec) => {29checkSoftwareSpec(fallbackSpec);30}31);32});3334function checkSoftwareSpec(spec: EnvData) {35// check that data has the expected structure36expect(spec.timestamp).toBeTruthy();37const inventory = spec.inventory;38expect(inventory).toBeTruthy();39expect(inventory.julia).toBeTruthy();40expect(inventory.language_exes).toBeTruthy();41expect(inventory.octave).toBeTruthy();42expect(inventory.python).toBeTruthy();43expect(inventory.R).toBeTruthy();44const data = spec.data;45expect(data).toBeTruthy();46expect(data.executables).toBeTruthy();47expect(data.julia).toBeTruthy();48expect(data.octave).toBeTruthy();49expect(data.python).toBeTruthy();50expect(data.R).toBeTruthy();51}525354