This PR mainly refactors the code by extracting a "core" package which is then used by the "backend" and "frontend" apps. Apart from this the PR also contains several smaller changes like fixing dependabot, upgrading dependencies, aligned "package.json" files, added tests, ... addresses step 1 of #32 closes #136 --------- Co-authored-by: Marco Pasqualetti <marco.pasqualetti@live.com>
28 lines
845 B
JavaScript
28 lines
845 B
JavaScript
// @ts-check
|
|
|
|
import { queryByTestId } from "@testing-library/dom";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { renderError } from "../src/common/render.js";
|
|
|
|
describe("Test render.js", () => {
|
|
it("should test renderError", () => {
|
|
document.body.innerHTML = renderError({ message: "Something went wrong" });
|
|
expect(
|
|
queryByTestId(document.body, "message")?.children[0],
|
|
).toHaveTextContent(/Something went wrong/gim);
|
|
expect(
|
|
queryByTestId(document.body, "message")?.children[1],
|
|
).toBeEmptyDOMElement();
|
|
|
|
// Secondary message
|
|
document.body.innerHTML = renderError({
|
|
message: "Something went wrong",
|
|
secondaryMessage: "Secondary Message",
|
|
});
|
|
expect(
|
|
queryByTestId(document.body, "message")?.children[1],
|
|
).toHaveTextContent(/Secondary Message/gim);
|
|
});
|
|
});
|