Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pit('should reject if `got` has rejected', () => {
mock_got.mockReturnValueOnce(Promise.resolve(null));
return searchClient.findCompatiblePackages('fakeBackend', []).then(
(ret) => {
throw new Error('Promise should not be resolved');
},
(err) => {
// done
}
);
});
});
pit('should return latest version and url', () => {
const latestVersion = '0.2.0';
const downloadUrl = 'download-0.2.0';
const githubAPIData = [
{
tag_name: `v${latestVersion}`,
html_url: downloadUrl
},
{
tag_name: 'v0.1.0',
html_url: 'fake'
}
];
mock_got.mockReturnValueOnce(
Promise.resolve({
body: githubAPIData
})
);
return checkForUpdate().then((res) => {
expect(res).toEqual({
version: latestVersion,
url: downloadUrl
});
});
});
});