Skip to content

Commit e6afe09

Browse files
committed
test(fuzz): testCheckRepoInAuthList
1 parent 6b450e0 commit e6afe09

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/testCheckRepoInAuthList.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const chai = require('chai');
22
const actions = require('../src/proxy/actions/Action');
33
const processor = require('../src/proxy/processors/push-action/checkRepoInAuthorisedList');
44
const expect = chai.expect;
5+
const fc = require('fast-check');
56

67
const authList = () => {
78
return [
@@ -24,4 +25,20 @@ describe('Check a Repo is in the authorised list', async () => {
2425
const result = await processor.exec(null, action, authList);
2526
expect(result.error).to.be.true;
2627
});
28+
29+
describe('fuzzing', () => {
30+
it('should not crash on random repo names', async () => {
31+
await fc.assert(
32+
fc.asyncProperty(
33+
fc.string(),
34+
async (repoName) => {
35+
const action = new actions.Action('123', 'type', 'get', 1234, repoName);
36+
const result = await processor.exec(null, action, authList);
37+
expect(result.error).to.be.true;
38+
}
39+
),
40+
{ numRuns: 100 }
41+
);
42+
});
43+
});
2744
});

0 commit comments

Comments
 (0)