Skip to content

Commit 7655803

Browse files
committed
test(model): config() method can merge request config recursively
1 parent dc617da commit 7655803

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/model.test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,4 +1065,25 @@ describe('Model methods', () => {
10651065
})
10661066
})
10671067
})
1068+
1069+
test('config() method can merge request config recursively', async () => {
1070+
let post
1071+
1072+
axiosMock.onAny().reply((config) => {
1073+
const _post = { ...post, foo: 'bar' }
1074+
1075+
expect(config.data).toEqual(JSON.stringify(_post))
1076+
1077+
return [200, {}]
1078+
})
1079+
1080+
post = new Post({ id: 1, title: 'Cool!' })
1081+
await post
1082+
.config({
1083+
data: {
1084+
foo: 'bar'
1085+
}
1086+
})
1087+
.save()
1088+
})
10681089
})

0 commit comments

Comments
 (0)