mirror of
https://github.com/codecov/codecov-action.git
synced 2026-02-11 21:01:38 +00:00
Add validation of checksums
This commit is contained in:
28
src/validate.test.ts
Normal file
28
src/validate.test.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import validateUploader from './validate';
|
||||
|
||||
const request = require('requestretry');
|
||||
|
||||
const bashScript = (async () => {
|
||||
try {
|
||||
const script = await request({
|
||||
json: false,
|
||||
maxAttempts: 10,
|
||||
timeout: 3000,
|
||||
url: 'https://codecov.io/bash',
|
||||
});
|
||||
return script.body;
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
|
||||
test('validChecksums', async () => {
|
||||
const valid = await validateUploader(await bashScript());
|
||||
expect(valid).toBeTruthy();
|
||||
});
|
||||
|
||||
test('invalidChecksums', async () => {
|
||||
const script = await bashScript();
|
||||
const valid = await validateUploader(script.substring(0, script.length - 1));
|
||||
expect(valid).toBeFalsy();
|
||||
});
|
||||
Reference in New Issue
Block a user