|
|
@@ -31,7 +31,7 @@ describe('get', () => {
|
|
|
expect(result).toEqual('a_response')
|
|
|
// @ts-ignore
|
|
|
expect(apiRequestService.request).toHaveBeenCalledWith(
|
|
|
- HTTP_METHOD.GET, 'https://myapi.com/api/item', null, null, { a: 1 }
|
|
|
+ HTTP_METHOD.GET, 'https://myapi.com/api/item', null, { a: 1 }
|
|
|
)
|
|
|
})
|
|
|
})
|
|
|
@@ -44,8 +44,7 @@ describe('post', () => {
|
|
|
const result = await apiRequestService.post(
|
|
|
'https://myapi.com/api/item',
|
|
|
'request_body',
|
|
|
- { a: 1 },
|
|
|
- { b: 2 },
|
|
|
+ { a: 1 }
|
|
|
)
|
|
|
|
|
|
expect(result).toEqual('a_response')
|
|
|
@@ -54,8 +53,7 @@ describe('post', () => {
|
|
|
HTTP_METHOD.POST,
|
|
|
'https://myapi.com/api/item',
|
|
|
'request_body',
|
|
|
- { a: 1 },
|
|
|
- { b: 2 }
|
|
|
+ { a: 1 }
|
|
|
)
|
|
|
})
|
|
|
})
|
|
|
@@ -68,8 +66,7 @@ describe('put', () => {
|
|
|
const result = await apiRequestService.put(
|
|
|
'https://myapi.com/api/item',
|
|
|
'request_body',
|
|
|
- { a: 1 },
|
|
|
- { b: 2 },
|
|
|
+ { a: 1 }
|
|
|
)
|
|
|
|
|
|
expect(result).toEqual('a_response')
|
|
|
@@ -78,8 +75,7 @@ describe('put', () => {
|
|
|
HTTP_METHOD.PUT,
|
|
|
'https://myapi.com/api/item',
|
|
|
'request_body',
|
|
|
- { a: 1 },
|
|
|
- { b: 2 }
|
|
|
+ { a: 1 }
|
|
|
)
|
|
|
})
|
|
|
})
|
|
|
@@ -91,7 +87,7 @@ describe('delete', () => {
|
|
|
|
|
|
const result = await apiRequestService.delete(
|
|
|
'https://myapi.com/api/item',
|
|
|
- { a: 1 },
|
|
|
+ { a: 1 }
|
|
|
)
|
|
|
|
|
|
expect(result).toEqual('a_response')
|
|
|
@@ -100,8 +96,7 @@ describe('delete', () => {
|
|
|
HTTP_METHOD.DELETE,
|
|
|
'https://myapi.com/api/item',
|
|
|
null,
|
|
|
- null,
|
|
|
- { a: 1 },
|
|
|
+ { a: 1 }
|
|
|
)
|
|
|
})
|
|
|
})
|
|
|
@@ -147,14 +142,13 @@ describe('request', () => {
|
|
|
expect(fetcher).toHaveBeenCalledWith('https://myapi.com/api/item', {method: 'GET'})
|
|
|
})
|
|
|
|
|
|
- test('with query and params', async () => {
|
|
|
+ test('with query', async () => {
|
|
|
// @ts-ignore
|
|
|
const result = await apiRequestService.request(
|
|
|
HTTP_METHOD.PUT,
|
|
|
'https://myapi.com/api/item',
|
|
|
'a_body',
|
|
|
- { a: 1 },
|
|
|
- { b: 2 }
|
|
|
+ { a: 1 }
|
|
|
)
|
|
|
|
|
|
expect(result).toEqual('fetch_response')
|
|
|
@@ -164,8 +158,7 @@ describe('request', () => {
|
|
|
{
|
|
|
method: 'PUT',
|
|
|
body: 'a_body',
|
|
|
- params: { a: 1 },
|
|
|
- query: { b: 2 },
|
|
|
+ query: { a: 1 },
|
|
|
}
|
|
|
)
|
|
|
})
|