File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1041,4 +1041,28 @@ describe('Model methods', () => {
10411041 comment . text = 'Hola!'
10421042 await comment . save ( )
10431043 } )
1044+
1045+ test ( 'config() method can change request config' , async ( ) => {
1046+ axiosMock . onGet ( 'http://localhost/posts' ) . reply ( ( config ) => {
1047+ expect ( config . params ) . toEqual ( {
1048+ foo : 'bar'
1049+ } )
1050+
1051+ return [ 200 , postsResponse ]
1052+ } )
1053+
1054+ const posts = await Post . config ( {
1055+ params : {
1056+ foo : 'bar'
1057+ }
1058+ } ) . get ( )
1059+
1060+ posts . forEach ( ( post ) => {
1061+ expect ( post ) . toBeInstanceOf ( Post )
1062+ expect ( post . user ) . toBeInstanceOf ( User )
1063+ post . relationships . tags . forEach ( ( tag ) => {
1064+ expect ( tag ) . toBeInstanceOf ( Tag )
1065+ } )
1066+ } )
1067+ } )
10441068} )
You can’t perform that action at this time.
0 commit comments