Refactor utils.fetch to a module and mock it with nock

Add redirect support in utils.fetch
This commit is contained in:
Shivam Mathur
2022-02-05 11:41:01 +05:30
parent 76555571a6
commit 4dc94c27cf
10 changed files with 292 additions and 129 deletions

View File

@ -33,6 +33,15 @@ jest.mock('../src/install', () => ({
})
}));
/**
* Mock fetch.ts
*/
jest.mock('../src/fetch', () => ({
fetch: jest.fn().mockImplementation(() => {
return {data: '{ "latest": "8.1", "5.x": "5.6" }'};
})
}));
describe('Install', () => {
it.each`
version | os | extension_csv | ini_file | ini_values_csv | coverage_driver | tools | output