import { isHttpHeaders , ValidateHttpHeadersConstraint , } from './http-headers.validator' ; describe ( 'isHttpHeaders()' , ( ) => { it ( 'should return true if the value is a object with values' , ( ) => { const values = { key1 : 'key1Value' , key2 : 'key2Value' , } ; const result = isHttpHeaders ( values ) ; expect ( result ) . toStrictEqual ( true ) ; } ) ; it ( 'should return true if the value is a void object' , ( ) => { const values = { } ; const result = isHttpHeaders ( values ) ; expect ( result ) . toStrictEqual ( true ) ; } ) ; it ( 'should return false if the value is a object with non-ascii value' , ( ) => { const values = { key1 : '£' , } ; const result = isHttpHeaders ( values ) ; expect ( result ) . toStrictEqual ( false ) ; } ) ; it ( 'should return false if the value is a object with non-ascii key' , ( ) => { const values = { '£' : 'pounds' , } ; const result = isHttpHeaders ( values ) ; expect ( result ) . toStrictEqual ( false ) ; } ) ; } ) ; describe ( 'ValidateHttpHeadersConstraint' , ( ) => { let instance ; beforeEach ( ( ) => { instance = new ValidateHttpHeadersConstraint ( ) ; } ) ; describe ( 'validate()' , ( ) => { it ( 'should validate the values' , ( ) => { const values = { echo : 'echoValue' , } ; const result = instance . validate ( values ) ; expect ( result ) . toBe ( true ) ; } ) ; it ( 'should return true if the value is a void object' , ( ) => { const values = { } ; const result = instance . validate ( values ) ; expect ( result ) . toStrictEqual ( true ) ; } ) ; it ( 'should return false if the value is a string' , ( ) => { const values = 'Sarah Connor' ; const result = instance . validate ( values ) ; expect ( result ) . toStrictEqual ( false ) ; } ) ; it ( 'should return false if the value is a number' , ( ) => { const values = 42 ; const result = instance . validate ( values ) ; expect ( result ) . toStrictEqual ( false ) ; } ) ; it ( 'should return false if the value is a object with non-ascii value' , ( ) => { const values = { key1 : '£' , } ; const result = instance . validate ( values ) ; expect ( result ) . toStrictEqual ( false ) ; } ) ; } ) ; describe ( 'defaultMessage()' , ( ) => { it ( 'should return the default message' , ( ) => { const result = instance . defaultMessage ( ) ; expect ( result ) . toStrictEqual ( 'Please check the HTTP headers values' ) ; } ) ; } ) ; } ) ;