1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-28 03:08:30 +00:00

Fixed content-types in mock requests

This commit is contained in:
Vladimir Volek 2018-09-13 15:44:38 +02:00
parent fc9adc95a4
commit be90c9bef9
2 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,7 @@ exports[`network utils httpRequest json ok response binary 1`] = `Promise {}`;
exports[`network utils httpRequest json ok response json 1`] = `
Object {
"test_json": "12345",
"test_json": 12345,
}
`;

View File

@ -6,19 +6,19 @@ describe('network utils', () => {
});
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');
expect(result).toMatchSnapshot();
});
it('httpRequest json ok response text', async () => {
fetch.mockResponse(JSON.stringify({ test_json: '12345' }));
const result = networkUtils.httpRequest('/http-request-test-response-text/', 'text');
fetch.mockResponseOnce('aaaa', { status: 200, headers: { 'content-type': 'text/html' } });
const result = networkUtils.httpRequest('/http-request-test-response-text/');
expect(result).toMatchSnapshot();
});
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');
expect(result).toMatchSnapshot();
});