Skip to content

Commit 3758d80

Browse files
committed
chore: add getMissingData action to chain and fix tests
1 parent ecca8d6 commit 3758d80

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/proxy/chain.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const pushActionChain: ((req: any, action: Action) => Promise<Action>)[] = [
1212
proc.push.checkIfWaitingAuth,
1313
proc.push.pullRemote,
1414
proc.push.writePack,
15+
proc.push.getMissingData,
1516
proc.push.preReceive,
1617
proc.push.getDiff,
1718
proc.push.clearBareClone,

src/proxy/processors/push-action/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { exec as checkCommitMessages } from './checkCommitMessages';
1212
import { exec as checkAuthorEmails } from './checkAuthorEmails';
1313
import { exec as checkUserPushPermission } from './checkUserPushPermission';
1414
import { exec as clearBareClone } from './clearBareClone';
15+
import { exec as getMissingData } from './getMissingData';
1516

1617
export {
1718
parsePush,
@@ -28,4 +29,5 @@ export {
2829
checkAuthorEmails,
2930
checkUserPushPermission,
3031
clearBareClone,
32+
getMissingData,
3133
};

test/chain.test.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const mockPushProcessors = {
3030
clearBareClone: sinon.stub(),
3131
scanDiff: sinon.stub(),
3232
blockForAuth: sinon.stub(),
33+
getMissingData: sinon.stub(),
3334
};
3435
mockPushProcessors.parsePush.displayName = 'parsePush';
3536
mockPushProcessors.audit.displayName = 'audit';
@@ -45,7 +46,7 @@ mockPushProcessors.getDiff.displayName = 'getDiff';
4546
mockPushProcessors.clearBareClone.displayName = 'clearBareClone';
4647
mockPushProcessors.scanDiff.displayName = 'scanDiff';
4748
mockPushProcessors.blockForAuth.displayName = 'blockForAuth';
48-
49+
mockPushProcessors.getMissingData.displayName = 'getMissingData';
4950
const mockPreProcessors = {
5051
parseAction: sinon.stub(),
5152
};
@@ -182,6 +183,7 @@ describe('proxy chain', function () {
182183
mockPushProcessors.clearBareClone.resolves(continuingAction);
183184
mockPushProcessors.scanDiff.resolves(continuingAction);
184185
mockPushProcessors.blockForAuth.resolves(continuingAction);
186+
mockPushProcessors.getMissingData.resolves(continuingAction);
185187

186188
const result = await chain.executeChain(req);
187189

@@ -200,6 +202,7 @@ describe('proxy chain', function () {
200202
expect(mockPushProcessors.scanDiff.called).to.be.true;
201203
expect(mockPushProcessors.blockForAuth.called).to.be.true;
202204
expect(mockPushProcessors.audit.called).to.be.true;
205+
expect(mockPushProcessors.getMissingData.called).to.be.true;
203206

204207
expect(result.type).to.equal('push');
205208
expect(result.allowPush).to.be.false;
@@ -279,7 +282,7 @@ describe('proxy chain', function () {
279282
mockPushProcessors.clearBareClone.resolves(action);
280283
mockPushProcessors.scanDiff.resolves(action);
281284
mockPushProcessors.blockForAuth.resolves(action);
282-
285+
mockPushProcessors.getMissingData.resolves(action);
283286
const dbStub = sinon.stub(db, 'authorise').resolves(true);
284287

285288
const result = await chain.executeChain(req);
@@ -325,6 +328,7 @@ describe('proxy chain', function () {
325328
mockPushProcessors.clearBareClone.resolves(action);
326329
mockPushProcessors.scanDiff.resolves(action);
327330
mockPushProcessors.blockForAuth.resolves(action);
331+
mockPushProcessors.getMissingData.resolves(action);
328332

329333
const dbStub = sinon.stub(db, 'reject').resolves(true);
330334

@@ -371,6 +375,7 @@ describe('proxy chain', function () {
371375
mockPushProcessors.clearBareClone.resolves(action);
372376
mockPushProcessors.scanDiff.resolves(action);
373377
mockPushProcessors.blockForAuth.resolves(action);
378+
mockPushProcessors.getMissingData.resolves(action);
374379

375380
const error = new Error('Database error');
376381

@@ -416,6 +421,7 @@ describe('proxy chain', function () {
416421
mockPushProcessors.clearBareClone.resolves(action);
417422
mockPushProcessors.scanDiff.resolves(action);
418423
mockPushProcessors.blockForAuth.resolves(action);
424+
mockPushProcessors.getMissingData.resolves(action);
419425

420426
const error = new Error('Database error');
421427

0 commit comments

Comments
 (0)