File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 11import { validateState } from './validate_state' ;
22
33describe ( 'Validate state' , ( ) => {
4+ test ( 'Should return no error if type is an object' , ( ) => {
5+ const errors = validateState ( { key : 'state' , value : { a : 1 } } ) ;
6+ expect ( errors ) . toHaveLength ( 0 ) ;
7+ } ) ;
8+
49 test ( 'Should return error if type is not an object' , ( ) => {
510 const errors = validateState ( { key : 'state' , value : 3 } ) ;
611 expect ( errors ) . toHaveLength ( 1 ) ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ interface ValidateStateOptions {
77 value : unknown ;
88}
99
10- export function validateState ( options : ValidateStateOptions ) {
10+ export function validateState ( options : ValidateStateOptions ) : ValidationError [ ] {
1111 if ( ! isObjectLiteral ( options . value ) ) {
1212 return [
1313 new ValidationError (
@@ -17,4 +17,6 @@ export function validateState(options: ValidateStateOptions) {
1717 ) ,
1818 ] ;
1919 }
20+
21+ return [ ] ;
2022}
You can’t perform that action at this time.
0 commit comments