import { render, screen } from "@testing-library/react"; import React from "react"; import "@testing-library/jest-dom"; import { SquiggleChart, SquiggleEditor, SquigglePlayground, } from "../src/index"; import { SqProject } from "@quri/squiggle-lang"; test("Chart logs nothing on render", async () => { const { unmount } = render(); unmount(); expect(console.log).not.toBeCalled(); expect(console.warn).not.toBeCalled(); expect(console.error).not.toBeCalled(); }); test("Editor logs nothing on render", async () => { const { unmount } = render(); unmount(); expect(console.log).not.toBeCalled(); expect(console.warn).not.toBeCalled(); expect(console.error).not.toBeCalled(); }); test("Project dependencies work in editors", async () => { const project = SqProject.create(); render(); const source = project.getSourceIds()[0]; const { container } = render( ); expect(container).toHaveTextContent("2"); }); test("Project dependencies work in playgrounds", async () => { const project = SqProject.create(); project.setSource("depend", "x = 1"); render( ); // We must await here because SquigglePlayground loads results asynchronously expect(await screen.findByRole("status")).toHaveTextContent("2"); });