@@ -138,23 +138,26 @@ describe('api', () => {
138138 } ) ;
139139
140140 describe ( 'quoteValueColumnWithDelimiters' , ( ) => {
141- const results : ISelectRowsResult = {
142- key : 'test' ,
143- models : {
144- test : {
145- 1 : { Name : { value : 'one' , url : 'http://one/test' , randomProperty : 123 } } ,
146- 2 : { Name : { value : 'with, comma' , url : 'http://with, comma/test' } } ,
147- 4 : { Name : { value : 'with "quotes", and comma' } } ,
148- 3 : { NoName : { value : 'nonesuch' , url : 'http://with, comma/test' } } ,
149- 5 : { Name : { value : ', comma first' , displayValue : ',' , url : 'http://with, comma/test' } } ,
141+ function getResults ( ) : ISelectRowsResult {
142+ return {
143+ key : 'test' ,
144+ models : {
145+ test : {
146+ 1 : { Name : { value : 'one' , url : 'http://one/test' , randomProperty : 123 } } ,
147+ 2 : { Name : { value : 'with, comma' , url : 'http://with, comma/test' } } ,
148+ 4 : { Name : { value : 'with "quotes", and comma' } } ,
149+ 3 : { NoName : { value : 'nonesuch' , url : 'http://with, comma/test' } } ,
150+ 5 : { Name : { value : ', comma first' , displayValue : ',' , url : 'http://with, comma/test' } } ,
151+ } ,
150152 } ,
151- } ,
152- orderedModels : List ( [ 1 , 2 , 3 , 4 , 5 ] ) ,
153- queries : { } ,
154- rowCount : 5 ,
155- } ;
156- test ( 'encode' , ( ) => {
157- expect ( quoteValueColumnWithDelimiters ( results , 'Name' , ',' ) ) . toStrictEqual ( {
153+ orderedModels : List ( [ 1 , 2 , 3 , 4 , 5 ] ) ,
154+ queries : { } ,
155+ rowCount : 5 ,
156+ } ;
157+ }
158+
159+ test ( 'encode (multiple=true by default)' , ( ) => {
160+ expect ( quoteValueColumnWithDelimiters ( getResults ( ) , 'Name' , ',' ) ) . toStrictEqual ( {
158161 key : 'test' ,
159162 models : {
160163 test : {
@@ -181,6 +184,24 @@ describe('api', () => {
181184 rowCount : 5 ,
182185 } ) ;
183186 } ) ;
187+
188+ test ( 'no encode when multiple=false' , ( ) => {
189+ expect ( quoteValueColumnWithDelimiters ( getResults ( ) , 'Name' , ',' , false ) ) . toStrictEqual ( {
190+ key : 'test' ,
191+ models : {
192+ test : {
193+ 1 : { Name : { value : 'one' , url : 'http://one/test' , displayValue : 'one' , randomProperty : 123 } } ,
194+ 2 : { Name : { value : 'with, comma' , url : 'http://with, comma/test' , displayValue : 'with, comma' } } ,
195+ 4 : { Name : { value : 'with "quotes", and comma' , displayValue : 'with "quotes", and comma' } } ,
196+ 3 : { NoName : { value : 'nonesuch' , url : 'http://with, comma/test' } } ,
197+ 5 : { Name : { value : ', comma first' , displayValue : ',' , url : 'http://with, comma/test' } } ,
198+ } ,
199+ } ,
200+ orderedModels : List ( [ 1 , 2 , 3 , 4 , 5 ] ) ,
201+ queries : { } ,
202+ rowCount : 5 ,
203+ } ) ;
204+ } ) ;
184205 } ) ;
185206
186207 test ( 'splitRowsByContainer' , ( ) => {
0 commit comments