Skip to content

Commit

Permalink
Update tests to use transform
Browse files Browse the repository at this point in the history
  • Loading branch information
mskelton committed Dec 16, 2023
1 parent 1674be3 commit 01565db
Show file tree
Hide file tree
Showing 6 changed files with 252 additions and 224 deletions.
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const config = {
transform: {
"^.+\\.(t|j)sx?$": "@swc-node/jest",
},
setupFilesAfterEnv: ["<rootDir>/setupTests.ts"],
};

export default config;
6 changes: 4 additions & 2 deletions src/__tests__/createTV.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import {expect, describe, test} from "@jest/globals";

import {createTV} from "../index";

describe("createTV", () => {
test("should use config in tv calls", () => {
const tv = createTV({twMerge: false});
const h1 = tv({base: "text-3xl font-bold text-blue-400 text-xl text-blue-200"});

expect(h1()).toBe("text-3xl font-bold text-blue-400 text-xl text-blue-200");
expect(h1()).toHaveClass("text-3xl font-bold text-blue-400 text-xl text-blue-200");
});

test("should override config", () => {
Expand All @@ -15,6 +17,6 @@ describe("createTV", () => {
{twMerge: true},
);

expect(h1()).toBe("font-bold text-xl text-blue-200");
expect(h1()).toHaveClass("font-bold text-xl text-blue-200");
});
});
2 changes: 2 additions & 0 deletions src/__tests__/transformer.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type {WithTV, TVTransformer} from "../transformer";

import {expect, describe, test} from "@jest/globals";

import {tvTransformer, withTV} from "../transformer";

type Mock = {
Expand Down
Loading

0 comments on commit 01565db

Please sign in to comment.