Skip to content

Commit 61c4ebc

Browse files
committed
Added a test to 16
1 parent a6560f0 commit 61c4ebc

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

src/03-art-of-type-arguments/16-class-names-creator.problem.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { expect, it } from "vitest";
2+
import { Equal, Expect } from "../helpers/type-utils";
23

34
const createClassNamesFactory =
45
(classes: unknown) =>
@@ -19,11 +20,17 @@ it("Should let you create classes from a className factory", () => {
1920

2021
it("Should let you pass additional classes which get appended", () => {
2122
expect(getBg("primary", "text-white", "rounded", "p-4")).toEqual(
22-
"bg-blue-500 text-white rounded p-4",
23+
"bg-blue-500 text-white rounded p-4"
2324
);
2425
});
2526

26-
it("Should not let you pass invalid classes", () => {
27+
it("Should return a type of string", () => {
28+
const result = getBg("primary");
29+
30+
type test = Expect<Equal<typeof result, string>>;
31+
});
32+
33+
it("Should not let you pass invalid variants", () => {
2734
// @ts-expect-error
2835
getBg("123123");
2936
});

src/03-art-of-type-arguments/16-class-names-creator.solution.1.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,17 @@ it("Should let you create classes from a className factory", () => {
1919

2020
it("Should let you pass additional classes which get appended", () => {
2121
expect(getBg("primary", "text-white", "rounded", "p-4")).toEqual(
22-
"bg-blue-500 text-white rounded p-4",
22+
"bg-blue-500 text-white rounded p-4"
2323
);
2424
});
2525

26-
it("Should not let you pass invalid classes", () => {
26+
it("Should return a type of string", () => {
27+
const result = getBg("primary");
28+
29+
type test = Expect<Equal<typeof result, string>>;
30+
});
31+
32+
it("Should not let you pass invalid variants", () => {
2733
// @ts-expect-error
2834
getBg("123123");
2935
});

src/03-art-of-type-arguments/16-class-names-creator.solution.2.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,17 @@ it("Should let you create classes from a className factory", () => {
1919

2020
it("Should let you pass additional classes which get appended", () => {
2121
expect(getBg("primary", "text-white", "rounded", "p-4")).toEqual(
22-
"bg-blue-500 text-white rounded p-4",
22+
"bg-blue-500 text-white rounded p-4"
2323
);
2424
});
2525

26-
it("Should not let you pass invalid classes", () => {
26+
it("Should return a type of string", () => {
27+
const result = getBg("primary");
28+
29+
type test = Expect<Equal<typeof result, string>>;
30+
});
31+
32+
it("Should not let you pass invalid variants", () => {
2733
// @ts-expect-error
2834
getBg("123123");
2935
});

0 commit comments

Comments
 (0)