mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-24 09:18:09 +00:00
Fixed content-types in mock requests
This commit is contained in:
parent
fc9adc95a4
commit
be90c9bef9
@ -14,7 +14,7 @@ exports[`network utils httpRequest json ok response binary 1`] = `Promise {}`;
|
|||||||
|
|
||||||
exports[`network utils httpRequest json ok response json 1`] = `
|
exports[`network utils httpRequest json ok response json 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"test_json": "12345",
|
"test_json": 12345,
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -6,19 +6,19 @@ describe('network utils', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('httpRequest json ok response json', async () => {
|
it('httpRequest json ok response json', async () => {
|
||||||
fetch.mockResponse(JSON.stringify({ test_json: '12345' }));
|
fetch.mockResponseOnce('{ "test_json": 12345 }', { status: 200, headers: { 'content-type': 'application/json' } });
|
||||||
const result = await networkUtils.httpRequest('/http-request-test-response-json/', 'json');
|
const result = await networkUtils.httpRequest('/http-request-test-response-json/', 'json');
|
||||||
expect(result).toMatchSnapshot();
|
expect(result).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('httpRequest json ok response text', async () => {
|
it('httpRequest json ok response text', async () => {
|
||||||
fetch.mockResponse(JSON.stringify({ test_json: '12345' }));
|
fetch.mockResponseOnce('aaaa', { status: 200, headers: { 'content-type': 'text/html' } });
|
||||||
const result = networkUtils.httpRequest('/http-request-test-response-text/', 'text');
|
const result = networkUtils.httpRequest('/http-request-test-response-text/');
|
||||||
expect(result).toMatchSnapshot();
|
expect(result).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('httpRequest json ok response binary', async () => {
|
it('httpRequest json ok response binary', async () => {
|
||||||
fetch.mockResponse(1);
|
fetch.mockResponseOnce('{ "id": 1 }', { status: 200, headers: { 'content-type': 'application/octet-stream' } });
|
||||||
const result = networkUtils.httpRequest('/http-request-test-response-binary/', 'binary');
|
const result = networkUtils.httpRequest('/http-request-test-response-binary/', 'binary');
|
||||||
expect(result).toMatchSnapshot();
|
expect(result).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user