@@ -28,23 +28,26 @@ describe('SchemaStore', () => {
2828 test ( 'GIVEN a schema and a value THEN it serializes and deserializes the buffer correctly' , ( ) => {
2929 const store = new SchemaStore ( 10 ) . add ( new Schema ( 2 ) . string ( 'name' ) . float64 ( 'height' ) ) ;
3030
31- const buffer = store . serialize ( 2 , { name : 'Mario' , height : 1.8 } ) ;
31+ const buffer = store . serializeRaw ( 2 , { name : 'Mario' , height : 1.8 } ) ;
3232 const deserialized = store . deserialize ( buffer ) ;
3333 expect < { id : 2 ; data : { height : number } } > ( deserialized ) . toEqual ( { id : 2 , data : { name : 'Mario' , height : 1.8 } } ) ;
3434
3535 expect < 2 > ( store . getIdentifier ( buffer ) ) . toBe ( 2 ) ;
3636 expect < 2 > ( store . getIdentifier ( buffer . toString ( ) ) ) . toBe ( 2 ) ;
37+
38+ expectTypeOf ( buffer ) . toEqualTypeOf < UnalignedUint16Array > ( ) ;
3739 } ) ;
3840
3941 test ( 'GIVEN a schema and a value THEN it serializes and deserializes the binary string correctly' , ( ) => {
4042 const store = new SchemaStore ( 10 ) . add ( new Schema ( 2 ) . string ( 'name' ) . float64 ( 'height' ) ) ;
4143
4244 const buffer = store . serialize ( 2 , { name : 'Mario' , height : 1.8 } ) ;
43- const deserialized = store . deserialize ( buffer . toString ( ) ) ;
45+ const deserialized = store . deserialize ( buffer ) ;
4446 expect < { id : 2 ; data : { height : number } } > ( deserialized ) . toEqual ( { id : 2 , data : { name : 'Mario' , height : 1.8 } } ) ;
4547
4648 expect < 2 > ( store . getIdentifier ( buffer ) ) . toBe ( 2 ) ;
47- expect < 2 > ( store . getIdentifier ( buffer . toString ( ) ) ) . toBe ( 2 ) ;
49+
50+ expectTypeOf ( buffer ) . toEqualTypeOf < string > ( ) ;
4851 } ) ;
4952
5053 test ( 'GIVEN a schema with a constant THEN it serializes and deserializes the buffer correctly' , ( ) => {
0 commit comments