@@ -12,16 +12,16 @@ describe("Valibot ID Validator", () => {
12
12
const schema = createValibotIdSchema ( userIdHelper ) ;
13
13
14
14
// Test that the schema validates the generated ID
15
- expect ( safeParse ( schema , id ) ) . toBe ( true ) ;
15
+ expect ( safeParse ( schema , id ) . success ) . toBe ( true ) ;
16
16
17
17
// 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 ) ;
19
19
20
20
// 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 ) ;
22
22
23
23
// 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 ) ;
25
25
} ) ;
26
26
27
27
it ( "should validate ID with custom options" , ( ) => {
@@ -36,19 +36,19 @@ describe("Valibot ID Validator", () => {
36
36
const schema = createValibotIdSchema ( userIdHelper ) ;
37
37
38
38
// Test that the schema validates the generated ID
39
- expect ( safeParse ( schema , id ) ) . toBe ( true ) ;
39
+ expect ( safeParse ( schema , id ) . success ) . toBe ( true ) ;
40
40
41
41
// 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 ) ;
43
43
44
44
// 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 ) ;
46
46
47
47
// 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 ) ;
49
49
50
50
// 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 ) ;
52
52
} ) ;
53
53
54
54
it ( "should validate ID with custom separator" , ( ) => {
@@ -59,13 +59,13 @@ describe("Valibot ID Validator", () => {
59
59
const schema = createValibotIdSchema ( userIdHelper ) ;
60
60
61
61
// Test that the schema validates the generated ID
62
- expect ( safeParse ( schema , id ) ) . toBe ( true ) ;
62
+ expect ( safeParse ( schema , id ) . success ) . toBe ( true ) ;
63
63
64
64
// 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 ) ;
66
66
67
67
// 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 ) ;
69
69
} ) ;
70
70
71
71
it ( "should validate ID with custom length" , ( ) => {
@@ -76,13 +76,13 @@ describe("Valibot ID Validator", () => {
76
76
const schema = createValibotIdSchema ( userIdHelper ) ;
77
77
78
78
// Test that the schema validates the generated ID
79
- expect ( safeParse ( schema , id ) ) . toBe ( true ) ;
79
+ expect ( safeParse ( schema , id ) . success ) . toBe ( true ) ;
80
80
81
81
// 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 ) ;
83
83
84
84
// 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 ) ;
86
86
} ) ;
87
87
88
88
it ( "should validate ID with custom alphabets" , ( ) => {
@@ -95,12 +95,12 @@ describe("Valibot ID Validator", () => {
95
95
const schema = createValibotIdSchema ( userIdHelper ) ;
96
96
97
97
// Test that the schema validates the generated ID
98
- expect ( safeParse ( schema , id ) ) . toBe ( true ) ;
98
+ expect ( safeParse ( schema , id ) . success ) . toBe ( true ) ;
99
99
100
100
// 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 ) ;
102
102
103
103
// 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 ) ;
105
105
} ) ;
106
106
} ) ;
0 commit comments