From 69e911dbf19237e207f5c1dc640a531e1e541749 Mon Sep 17 00:00:00 2001 From: regevbr Date: Fri, 22 Nov 2019 01:46:37 +0200 Subject: [PATCH] Fix #70 Add DLQ rebumitter tool --- .nycrc | 4 ++-- package.json | 4 ++-- src/test/src/index.spec.ts | 2 +- src/test/src/resubmitter.spec.ts | 25 +++++++------------------ 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/.nycrc b/.nycrc index 2229867..fd026ff 100644 --- a/.nycrc +++ b/.nycrc @@ -1,6 +1,6 @@ { "extends": "@istanbuljs/nyc-config-typescript", "exclude": ["src/test/**"], - "sourceMap": false, - "produce-source-map": false + "sourceMap": true, + "produce-source-map": true } diff --git a/package.json b/package.json index c1fe913..e8b2b60 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "scripts": { "test": "npm run lint && npm run mocha", "lint": "tslint -c tslint.json 'src/**/*.ts'", - "mocha": "node --preserve-symlinks -r source-map-support/register node_modules/mocha/bin/_mocha --opts src/test/mocha.opts", - "cover": "npm run cleanCoverage && nyc --reporter=lcov --reporter=text-summary npm run test", + "mocha": "node -r source-map-support/register node_modules/mocha/bin/_mocha --opts src/test/mocha.opts", + "cover": "npm run cleanCoverage && nyc --reporter=html --reporter=cobertura --reporter=text-summary npm run test", "compile": "./node_modules/.bin/tsc", "cleanCoverage": "rm -rf .nyc_output coverage", "cleanDist": "rm -rf dist", diff --git a/src/test/src/index.spec.ts b/src/test/src/index.spec.ts index 763e6a9..2b16bb9 100644 --- a/src/test/src/index.spec.ts +++ b/src/test/src/index.spec.ts @@ -627,7 +627,7 @@ describe('index', () => { const spy = sinon.spy(inst!.sqs, 'deleteMessageBatch'); inst!.on('message', (msg: Message) => msg.del()); inst!.start(); - return wait().then(() => { + return wait(50).then(() => { spy.should.be.calledTwice(); }); }); diff --git a/src/test/src/resubmitter.spec.ts b/src/test/src/resubmitter.spec.ts index 197f23a..85c821d 100644 --- a/src/test/src/resubmitter.spec.ts +++ b/src/test/src/resubmitter.spec.ts @@ -1,27 +1,16 @@ 'use strict'; -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 {Resubmitter} from '../../index'; import {SQSStub} from '../stubs/SQSStub'; -import {SQS} from 'aws-sdk'; +import {Squiss, SQS} from '../../index'; describe('resubmitter', () => { - 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'}); + it('should work', function() { + this.timeout(2000000); + const squissFrom = new Squiss({queueUrl: 'foo_DLQ'}); + squissFrom!.sqs = new SQSStub(2, 0) as any as SQS; + const squissTo = new Squiss({queueUrl: 'foo'}); squissTo!.sqs = new SQSStub(0, 0) as any as SQS; const resubmitter = new Resubmitter({ limit: 1,