@@ -203,6 +203,7 @@ describe("Scope", () => {
203203 . select ( { pets : [ "type" ] } )
204204 . selectExtra ( { people : [ "net_worth" ] } )
205205 . stats ( { total : "count" } )
206+ . extraParams ( { foo : "bar" } )
206207 . includes ( { a : [ "b" , { c : "d" } ] } )
207208 const qp = scope . asQueryParams ( )
208209
@@ -226,6 +227,7 @@ describe("Scope", () => {
226227 stats : {
227228 total : "count"
228229 } ,
230+ foo : "bar" ,
229231 include : "a.b,a.c.d"
230232 } )
231233 } )
@@ -259,6 +261,23 @@ describe("Scope", () => {
259261 expect ( scope . toQueryParams ( ) ) . to . eq ( undefined )
260262 } )
261263 } )
264+
265+ describe ( "when arbitrary query params added" , ( ) => {
266+ it ( "adds to the param string" , ( ) => {
267+ scope = scope . extraParams ( { foo : "bar" , bar : "baz" } )
268+ expect ( ( < string > scope . toQueryParams ( ) ) ) . to . eq ( "foo=bar&bar=baz" )
269+ } )
270+
271+ it ( "casts arrays correctly" , ( ) => {
272+ scope = scope . extraParams ( { foo : "bar,baz" } )
273+ expect ( ( < string > scope . toQueryParams ( ) ) ) . to . eq ( "foo=bar,baz" )
274+ } )
275+
276+ it ( "casts objects correctly" , ( ) => {
277+ scope = scope . extraParams ( { foo : { bar : "baz" } } )
278+ expect ( ( < string > scope . toQueryParams ( ) ) ) . to . eq ( "foo[bar]=baz" )
279+ } )
280+ } )
262281 } )
263282
264283 describe ( "#copy" , ( ) => {
0 commit comments