import { act, create } from "react-test-renderer"; import Script from "../script"; describe("Script", () => { test("should not render a script tag without code or src", () => { let root; act(() => { root = create(); }); // This is here to make sure the virtual dom tree does not return anything. expect(root.toJSON()).toMatchInlineSnapshot(`null`); expect(document.body.querySelector("#script-1")).toBeNull(); }); test("should render a script tag with src", () => { act(() => { create( ); }); expect(document.body.querySelector("#script-3")).toMatchInlineSnapshot(`