feat(tests): add fresh-testing-library tests (#1990)

This commit is contained in:
Craig Doremus
2023-11-15 18:25:13 +01:00
committed by GitHub
parent 5d690bede1
commit b5816cd001
20 changed files with 447 additions and 8 deletions
@@ -0,0 +1,16 @@
import { assertEquals } from "$std/testing/asserts.ts";
import { cleanup, render, setup } from "$fresh-testing-library";
import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts";
import Background from "$fresh/www/components/gallery/Background.tsx";
describe("components/gallery/Background.tsx", () => {
beforeAll(setup);
afterEach(cleanup);
it("should display background image", () => {
const { getByTitle } = render(<Background title="background" />);
const bg = getByTitle("background");
const style = bg.getAttribute("style");
assertEquals(style, "background-image: url(/gallery/grid.svg);");
});
});