File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ export default class Parser {
1313
1414 // final query string
1515 query ( ) {
16+ this . reset ( )
1617 this . includes ( )
1718 this . appends ( )
1819 this . fields ( )
@@ -25,6 +26,10 @@ export default class Parser {
2526 return this . uri
2627 }
2728
29+ reset ( ) {
30+ this . uri = ''
31+ }
32+
2833 /**
2934 * Helpers
3035 */
Original file line number Diff line number Diff line change @@ -198,4 +198,15 @@ describe('Query builder', () => {
198198
199199 expect ( errorModel ) . toThrow ( 'You must pass a payload/object as param.' )
200200 } )
201+
202+ test ( 'it resets the uri upon query generation when the query is regenerated a second time' , ( ) => {
203+ const post = Post
204+ . where ( 'title' , 'Cool' )
205+ . page ( 4 )
206+
207+ const query = '?filter[title]=Cool&page=4'
208+
209+ expect ( post . _builder . query ( ) ) . toEqual ( query )
210+ expect ( post . _builder . query ( ) ) . toEqual ( query )
211+ } )
201212} )
You can’t perform that action at this time.
0 commit comments