Skip to content

Commit

Permalink
test: increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Cweili committed Jan 5, 2024
1 parent 9b1607e commit b2c8ad6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"prepublishOnly": "npm run package",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test": "vitest",
"test": "vitest --typecheck.tsconfig ./tsconfig.json",
"lint": "prettier --check . && eslint --ignore-path .gitignore .",
"format": "prettier --write .",
"deploy": "npm run build && gh-pages -t -d build"
Expand Down
7 changes: 4 additions & 3 deletions src/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { describe, expect, test, afterEach } from "vitest";
// @ts-expect-error No typings available
import { fasFlag, fasInfo } from "@cweili/fa-test-util";
import { render, screen, cleanup } from "@testing-library/svelte";
import Fa from "./lib/fa.svelte";
import Fa from "./lib";

function mountFa(props: Partial<ComponentProps<Fa>>) {
cleanup();
Expand Down Expand Up @@ -125,7 +125,7 @@ describe("size", () => {

test("scale", async () => {
mountFa({
scale: 0.5,
scale: "0.5",
});
let transform = getFa().querySelector("g > g")?.getAttribute("transform");
expect(transform).toContain("scale(0.5,0.5)");
Expand All @@ -139,7 +139,8 @@ test("scale", async () => {

test("translate", async () => {
mountFa({
translateX: 1,
translateX: "1",
translateY: "0",
});
let transform = getFa().querySelector("g > g")?.getAttribute("transform");
expect(transform).toContain("translate(512,0)");
Expand Down
2 changes: 1 addition & 1 deletion src/duotone.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { expect, test, afterEach } from "vitest";
// @ts-expect-error No typings available
import { fasFlag, fadFlag, fadInfo } from "@cweili/fa-test-util";
import { render, screen, cleanup } from "@testing-library/svelte";
import Fa from "./lib/fa.svelte";
import Fa from "./lib";

function mountFa(props: Partial<ComponentProps<Fa>>) {
cleanup();
Expand Down
7 changes: 5 additions & 2 deletions src/layers.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { describe, expect, test, afterEach } from "vitest";
import { render, screen, cleanup, configure } from "@testing-library/svelte";
import FaLayers from "./lib/fa-layers.svelte";
import FaLayersText from "./lib/fa-layers-text.svelte";
import type { ComponentProps } from "svelte";

import {
FaLayers,
FaLayersText,
} from "./lib";

configure({ testIdAttribute: "id" });
afterEach(cleanup);

Expand Down

0 comments on commit b2c8ad6

Please sign in to comment.