Skip to content

Commit

Permalink
Fix #70 Add DLQ rebumitter tool
Browse files Browse the repository at this point in the history
  • Loading branch information
regevbr committed Nov 21, 2019
1 parent a9b6f1b commit dfe4a7f
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions src/test/src/resubmitter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,41 @@
'use strict';

// import {resubmitMessages} from '../../resubmitter';
import * as proxyquire from 'proxyquire';

const uuidStub = () => {
return 'my_uuid';
};
(uuidStub as any)['@global'] = true;
const stubs = {
'uuid/v4': uuidStub,
};
// tslint:disable-next-line
const {Squiss: SquissPatched} = proxyquire('../../', stubs);

import {Resubmitter} from '../../resubmitter';
import {SQSStub} from '../stubs/SQSStub';
import {SQS} from 'aws-sdk';

describe('resubmitter', () => {

it('shouw work', () => {
// return resubmitMessages({
//
// });
});
it('should work', () => {
const squissFrom = new SquissPatched({queueUrl: 'foo_DLQ'});
squissFrom!.sqs = new SQSStub(15, 0) as any as SQS;
const squissTo = new SquissPatched({queueUrl: 'foo'});
squissTo!.sqs = new SQSStub(0, 0) as any as SQS;
const resubmitter = new Resubmitter({
limit: 1,
releaseTimeoutSeconds: 30,
resubmitFromQueueConfig: {
queueUrl: 'foo_DLQ',
},
resubmitToQueueConfig: {
queueUrl: 'foo',
},
});
resubmitter.squissFrom = squissFrom;
resubmitter.squissTo = squissTo;
return resubmitter.run();
});

});

0 comments on commit dfe4a7f

Please sign in to comment.