@@ -32,7 +32,7 @@ describe("validationSchema", () => {
32
32
} )
33
33
34
34
it ( "disallows ttl to be negative" , ( ) => {
35
- const values = {
35
+ const values : WorkspaceScheduleFormValues = {
36
36
...valid ,
37
37
ttl : - 1 ,
38
38
}
@@ -41,7 +41,7 @@ describe("validationSchema", () => {
41
41
} )
42
42
43
43
it ( "disallows all days-of-week to be false when startTime is set" , ( ) => {
44
- const values = {
44
+ const values : WorkspaceScheduleFormValues = {
45
45
...valid ,
46
46
sunday : false ,
47
47
monday : false ,
@@ -54,4 +54,40 @@ describe("validationSchema", () => {
54
54
const validate = ( ) => validationSchema . validateSync ( values )
55
55
expect ( validate ) . toThrowError ( Language . errorNoDayOfWeek )
56
56
} )
57
+
58
+ it ( "disallows startTime to be H:mm" , ( ) => {
59
+ const values : WorkspaceScheduleFormValues = {
60
+ ...valid ,
61
+ startTime : "9:30" ,
62
+ }
63
+ const validate = ( ) => validationSchema . validateSync ( values )
64
+ expect ( validate ) . toThrowError ( Language . errorTime )
65
+ } )
66
+
67
+ it ( "disallows startTime to be HH:m" , ( ) => {
68
+ const values : WorkspaceScheduleFormValues = {
69
+ ...valid ,
70
+ startTime : "09:5" ,
71
+ }
72
+ const validate = ( ) => validationSchema . validateSync ( values )
73
+ expect ( validate ) . toThrowError ( Language . errorTime )
74
+ } )
75
+
76
+ it ( "disallows an invalid startTime 13:01" , ( ) => {
77
+ const values : WorkspaceScheduleFormValues = {
78
+ ...valid ,
79
+ startTime : "13:01" ,
80
+ }
81
+ const validate = ( ) => validationSchema . validateSync ( values )
82
+ expect ( validate ) . toThrowError ( Language . errorTime )
83
+ } )
84
+
85
+ it ( "disallows an invalid startTime 09:60" , ( ) => {
86
+ const values : WorkspaceScheduleFormValues = {
87
+ ...valid ,
88
+ startTime : "09:60" ,
89
+ }
90
+ const validate = ( ) => validationSchema . validateSync ( values )
91
+ expect ( validate ) . toThrowError ( Language . errorTime )
92
+ } )
57
93
} )
0 commit comments