Skip to content

Commit 24dbd1f

Browse files
🐛 use boolean value in testcase
1 parent 3ec4291 commit 24dbd1f

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

tests/validators/validbot.test.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ describe("Valibot ID Validator", () => {
1212
const schema = createValibotIdSchema(userIdHelper);
1313

1414
// Test that the schema validates the generated ID
15-
expect(safeParse(schema, id)).toBe(true);
15+
expect(safeParse(schema, id).success).toBe(true);
1616

1717
// Test that the schema rejects IDs with different prefix
18-
expect(safeParse(schema, "person_0123456789")).toBe(false);
18+
expect(safeParse(schema, "person_0123456789").success).toBe(false);
1919

2020
// Test that the schema rejects IDs with different separator
21-
expect(safeParse(schema, "user::0123456789")).toBe(false);
21+
expect(safeParse(schema, "user::0123456789").success).toBe(false);
2222

2323
// Test that the schema rejects IDs with different length
24-
expect(safeParse(schema, "user_1234")).toBe(false);
24+
expect(safeParse(schema, "user_1234").success).toBe(false);
2525
});
2626

2727
it("should validate ID with custom options", () => {
@@ -36,19 +36,19 @@ describe("Valibot ID Validator", () => {
3636
const schema = createValibotIdSchema(userIdHelper);
3737

3838
// Test that the schema validates the generated ID
39-
expect(safeParse(schema, id)).toBe(true);
39+
expect(safeParse(schema, id).success).toBe(true);
4040

4141
// Test that the schema rejects IDs with different prefix
42-
expect(safeParse(schema, "person::abcdefghijkl")).toBe(false);
42+
expect(safeParse(schema, "person::abcdefghijkl").success).toBe(false);
4343

4444
// Test that the schema rejects IDs with different separator
45-
expect(safeParse(schema, "user_abcdefghijkl")).toBe(false);
45+
expect(safeParse(schema, "user_abcdefghijkl").success).toBe(false);
4646

4747
// Test that the schema rejects IDs with different length
48-
expect(safeParse(schema, "user::abcdefghijk")).toBe(false);
48+
expect(safeParse(schema, "user::abcdefghijk").success).toBe(false);
4949

5050
// Test that the schema rejects IDs with different alphabets
51-
expect(safeParse(schema, "user::0123456789123")).toBe(false);
51+
expect(safeParse(schema, "user::0123456789123").success).toBe(false);
5252
});
5353

5454
it("should validate ID with custom separator", () => {
@@ -59,13 +59,13 @@ describe("Valibot ID Validator", () => {
5959
const schema = createValibotIdSchema(userIdHelper);
6060

6161
// Test that the schema validates the generated ID
62-
expect(safeParse(schema, id)).toBe(true);
62+
expect(safeParse(schema, id).success).toBe(true);
6363

6464
// Test that the schema rejects IDs with different prefix
65-
expect(safeParse(schema, "person::0123456789")).toBe(false);
65+
expect(safeParse(schema, "person::0123456789").success).toBe(false);
6666

6767
// Test that the schema rejects IDs with different separator
68-
expect(safeParse(schema, "user_0123456789")).toBe(false);
68+
expect(safeParse(schema, "user_0123456789").success).toBe(false);
6969
});
7070

7171
it("should validate ID with custom length", () => {
@@ -76,13 +76,13 @@ describe("Valibot ID Validator", () => {
7676
const schema = createValibotIdSchema(userIdHelper);
7777

7878
// Test that the schema validates the generated ID
79-
expect(safeParse(schema, id)).toBe(true);
79+
expect(safeParse(schema, id).success).toBe(true);
8080

8181
// Test that the schema rejects IDs with different prefix
82-
expect(safeParse(schema, "person_0123456789")).toBe(false);
82+
expect(safeParse(schema, "person_0123456789").success).toBe(false);
8383

8484
// Test that the schema rejects IDs with different length
85-
expect(safeParse(schema, "user_0123456789")).toBe(false);
85+
expect(safeParse(schema, "user_0123456789").success).toBe(false);
8686
});
8787

8888
it("should validate ID with custom alphabets", () => {
@@ -95,12 +95,12 @@ describe("Valibot ID Validator", () => {
9595
const schema = createValibotIdSchema(userIdHelper);
9696

9797
// Test that the schema validates the generated ID
98-
expect(safeParse(schema, id)).toBe(true);
98+
expect(safeParse(schema, id).success).toBe(true);
9999

100100
// Test that the schema rejects IDs with different prefix
101-
expect(safeParse(schema, "person_0123456789")).toBe(false);
101+
expect(safeParse(schema, "person_0123456789").success).toBe(false);
102102

103103
// Test that the schema rejects IDs with different alphabets
104-
expect(safeParse(schema, "user_0123456789123")).toBe(false);
104+
expect(safeParse(schema, "user_0123456789123").success).toBe(false);
105105
});
106106
});

0 commit comments

Comments
 (0)