@@ -100,33 +100,37 @@ describe('createFormatter', () => {
100100 describe ( 'for filter arguments' , ( ) => {
101101 it ( 'must handle empty args' , ( ) => {
102102 const cb = jest . spyOn ( fullFormatter . filters . json , 'transform' ) ;
103- fullFormat ( '${value|json:}' , { value : 'message' } ) ;
104- expect ( cb ) . toHaveBeenCalledWith ( 'message ', [ '' ] ) ;
105-
106- fullFormat ( '${value|json:::Hello World!}' , { value : 'message' } ) ;
107- expect ( cb ) . toHaveBeenCalledWith ( 'message' , [ '' , '' , 'Hello World!' ] ) ;
103+ const obj = { value : 'message' } ;
104+ fullFormat ( '${value|json:} ', obj ) ;
105+ expect ( cb ) . toHaveBeenCalledWith ( 'message' , [ '' ] , obj ) ;
106+ fullFormat ( '${value|json:::Hello World!}' , obj ) ;
107+ expect ( cb ) . toHaveBeenCalledWith ( 'message' , [ '' , '' , 'Hello World!' ] , obj ) ;
108108 } ) ;
109109 it ( 'must resolve numbers' , ( ) => {
110110 const cb = jest . spyOn ( fullFormatter . filters . json , 'transform' ) ;
111- fullFormat ( '${value|json: 1: 22.33: -45.678}' , { value : 'message' } ) ;
112- expect ( cb ) . toHaveBeenCalledWith ( 'message' , [ '1' , '22.33' , '-45.678' ] ) ;
111+ const obj = { value : 'message' } ;
112+ fullFormat ( '${value|json: 1: 22.33: -45.678}' , obj ) ;
113+ expect ( cb ) . toHaveBeenCalledWith ( 'message' , [ '1' , '22.33' , '-45.678' ] , obj ) ;
113114 } ) ;
114115 it ( 'must resolve random text with spaces' , ( ) => {
115116 const cb1 = jest . spyOn ( fullFormatter . filters . json , 'transform' ) ;
116117 const cb2 = jest . spyOn ( fullFormatter , 'getDefaultFilter' ) ;
117- fullFormat ( '${value|object: Hello World! : Where are we? }' , { value : 'message' } ) ;
118- expect ( cb1 ) . toHaveBeenCalledWith ( 'message' , [ 'Hello World!' , 'Where are we?' ] ) ;
118+ const obj = { value : 'message' } ;
119+ fullFormat ( '${value|object: Hello World! : Where are we? }' , obj ) ;
120+ expect ( cb1 ) . toHaveBeenCalledWith ( 'message' , [ 'Hello World!' , 'Where are we?' ] , obj ) ;
119121 expect ( cb2 ) . toHaveBeenCalledWith ( 'object' , [ 'Hello World!' , 'Where are we?' ] ) ;
120122 } ) ;
121123 it ( 'must decode HTML symbols by default' , ( ) => {
122124 const cb = jest . spyOn ( fullFormatter . filters . json , 'transform' ) ;
123- fullFormat ( '${value|json: :}' , { value : 'message' } ) ;
124- expect ( cb ) . toHaveBeenCalledWith ( 'message' , [ ':' ] ) ;
125+ const obj = { value : 'message' } ;
126+ fullFormat ( '${value|json: :}' , obj ) ;
127+ expect ( cb ) . toHaveBeenCalledWith ( 'message' , [ ':' ] , obj ) ;
125128 } ) ;
126129 it ( 'must not decode HTML symbols with override present' , ( ) => {
127130 const cb = jest . spyOn ( fullFormatter . filters . append , 'transform' ) ;
128- fullFormat ( '${value|append: :}' , { value : 'message' } ) ;
129- expect ( cb ) . toHaveBeenCalledWith ( 'message' , [ ':' ] ) ;
131+ const obj = { value : 'message' } ;
132+ fullFormat ( '${value|append: :}' , obj ) ;
133+ expect ( cb ) . toHaveBeenCalledWith ( 'message' , [ ':' ] , obj ) ;
130134 } ) ;
131135 } ) ;
132136} ) ;
0 commit comments