Skip to content

Commit 7cf24ee

Browse files
committed
feat: integrate checkCryptoImplementation into the main processing chain
Signed-off-by: ChaitanyaD48 <[email protected]>
1 parent 3c929d5 commit 7cf24ee

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/proxy/chain.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const pushActionChain = [
1111
proc.push.writePack,
1212
proc.push.getDiff,
1313
proc.push.clearBareClone,
14+
proc.push.checkCryptoImplementation,
1415
proc.push.scanDiff,
1516
proc.push.blockForAuth,
1617
];

test/chain.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const mockPushProcessors = {
1919
audit: sinon.stub(),
2020
checkRepoInAuthorisedList: sinon.stub(),
2121
checkCommitMessages: sinon.stub(),
22+
checkCryptoImplementation: sinon.stub(),
2223
checkAuthorEmails: sinon.stub(),
2324
checkUserPushPermission: sinon.stub(),
2425
checkIfWaitingAuth: sinon.stub(),
@@ -33,6 +34,7 @@ mockPushProcessors.parsePush.displayName = 'parsePush';
3334
mockPushProcessors.audit.displayName = 'audit';
3435
mockPushProcessors.checkRepoInAuthorisedList.displayName = 'checkRepoInAuthorisedList';
3536
mockPushProcessors.checkCommitMessages.displayName = 'checkCommitMessages';
37+
mockPushProcessors.checkCryptoImplementation.displayName = 'checkCryptoImplementation';
3638
mockPushProcessors.checkAuthorEmails.displayName = 'checkAuthorEmails';
3739
mockPushProcessors.checkUserPushPermission.displayName = 'checkUserPushPermission';
3840
mockPushProcessors.checkIfWaitingAuth.displayName = 'checkIfWaitingAuth';
@@ -106,6 +108,7 @@ describe('proxy chain', function () {
106108
mockPushProcessors.checkCommitMessages.resolves(continuingAction);
107109
mockPushProcessors.checkAuthorEmails.resolves(continuingAction);
108110
mockPushProcessors.checkUserPushPermission.resolves(continuingAction);
111+
mockPushProcessors.checkCryptoImplementation.resolves(continuingAction);
109112

110113
// this stops the chain from further execution
111114
mockPushProcessors.checkIfWaitingAuth.resolves({ type: 'push', continue: () => false, allowPush: false });
@@ -120,6 +123,7 @@ describe('proxy chain', function () {
120123
expect(mockPushProcessors.checkIfWaitingAuth.called).to.be.true;
121124
expect(mockPushProcessors.pullRemote.called).to.be.false;
122125
expect(mockPushProcessors.audit.called).to.be.true;
126+
expect(mockPushProcessors.checkCryptoImplementation.called).to.be.true;
123127

124128
expect(result.type).to.equal('push');
125129
expect(result.allowPush).to.be.false;
@@ -131,10 +135,12 @@ describe('proxy chain', function () {
131135
const continuingAction = { type: 'push', continue: () => true, allowPush: false };
132136
mockPreProcessors.parseAction.resolves({ type: 'push' });
133137
mockPushProcessors.parsePush.resolves(continuingAction);
138+
mockPushProcessors.checkCryptoImplementation.resolves(continuingAction);
134139
mockPushProcessors.checkRepoInAuthorisedList.resolves(continuingAction);
135140
mockPushProcessors.checkCommitMessages.resolves(continuingAction);
136141
mockPushProcessors.checkAuthorEmails.resolves(continuingAction);
137142
mockPushProcessors.checkUserPushPermission.resolves(continuingAction);
143+
138144
// this stops the chain from further execution
139145
mockPushProcessors.checkIfWaitingAuth.resolves({ type: 'push', continue: () => true, allowPush: true });
140146
const result = await chain.executeChain(req);
@@ -148,6 +154,7 @@ describe('proxy chain', function () {
148154
expect(mockPushProcessors.checkIfWaitingAuth.called).to.be.true;
149155
expect(mockPushProcessors.pullRemote.called).to.be.false;
150156
expect(mockPushProcessors.audit.called).to.be.true;
157+
expect(mockPushProcessors.checkCryptoImplementation.called).to.be.true;
151158

152159
expect(result.type).to.equal('push');
153160
expect(result.allowPush).to.be.true;
@@ -170,6 +177,7 @@ describe('proxy chain', function () {
170177
mockPushProcessors.clearBareClone.resolves(continuingAction);
171178
mockPushProcessors.scanDiff.resolves(continuingAction);
172179
mockPushProcessors.blockForAuth.resolves(continuingAction);
180+
mockPushProcessors.checkCryptoImplementation.resolves(continuingAction);
173181

174182
const result = await chain.executeChain(req);
175183

@@ -187,6 +195,7 @@ describe('proxy chain', function () {
187195
expect(mockPushProcessors.scanDiff.called).to.be.true;
188196
expect(mockPushProcessors.blockForAuth.called).to.be.true;
189197
expect(mockPushProcessors.audit.called).to.be.true;
198+
expect(mockPushProcessors.checkCryptoImplementation.called).to.be.true;
190199

191200
expect(result.type).to.equal('push');
192201
expect(result.allowPush).to.be.false;

0 commit comments

Comments
 (0)