Skip to content

Commit

Permalink
fix(unpkg): remove json flag + add unit test (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
bodinsamuel authored Aug 8, 2019
1 parent d2f00e2 commit d706694
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/__tests__/unpkg.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { fileExistsInUnpkg } from '../unpkg.js';

describe('unpkg', () => {
it('should do a successful HEAD request', async () => {
const exists = await fileExistsInUnpkg('jest', '24.8.0', 'bin/jest.js');
expect(exists).toBe(true);
});

it('should do a failed HEAD request', async () => {
const exists = await fileExistsInUnpkg(
'jest',
'24.8.0',
'bin/notexists.js'
);
expect(exists).toBe(false);
});
});
1 change: 0 additions & 1 deletion src/unpkg.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export async function fileExistsInUnpkg(pkg, version, path) {
const uri = `${config.unpkgRoot}/${pkg}@${version}/${path}`;
try {
const response = await got(uri, {
json: true,
method: 'HEAD',
});
return response.statusCode === 200;
Expand Down

0 comments on commit d706694

Please sign in to comment.