diff --git a/.eslintrc.js b/.eslintrc.js index 0dc77dd..e88b716 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,7 +9,6 @@ module.exports = { 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', 'prettier', - 'prettier/@typescript-eslint', ], root: true, env: { diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 05252d7..30ab24c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x, 14.x, 16.x] + node-version: [16.x] services: elasticmq: image: s12v/elasticmq diff --git a/.vscode/settings.json b/.vscode/settings.json index 3662b37..f37826d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "typescript.tsdk": "node_modules/typescript/lib" -} \ No newline at end of file + "typescript.tsdk": "node_modules/typescript/lib", + "editor.formatOnPaste": true +} diff --git a/e2e/module.e2e-spec.ts b/e2e/module.e2e-spec.ts index 9ed0e77..30de8bb 100644 --- a/e2e/module.e2e-spec.ts +++ b/e2e/module.e2e-spec.ts @@ -3,11 +3,9 @@ import { SqsModule, SqsService } from '../lib'; import { SqsConsumerOptions, SqsProducerOptions } from '../lib/sqs.types'; import { Injectable } from '@nestjs/common'; import { SqsConsumerEventHandler, SqsMessageHandler } from '../lib/sqs.decorators'; -import * as AWS from 'aws-sdk'; -import { promisify } from 'util'; import waitForExpect from 'wait-for-expect'; +import { Message, SQSClient as SQS } from '@aws-sdk/client-sqs'; -const delay = promisify(setTimeout); const SQS_ENDPOINT = process.env.SQS_ENDPOINT || 'http://localhost:9324'; enum TestQueue { @@ -15,9 +13,10 @@ enum TestQueue { DLQ = 'test-dead', } -const sqs = new AWS.SQS({ +const sqs = new SQS({ apiVersion: '2012-11-05', - credentials: new AWS.Credentials('x', 'x'), + credentials: { accessKeyId: 'x', secretAccessKey: 'x'}, + endpoint: SQS_ENDPOINT, region: 'none', }); @@ -37,8 +36,6 @@ const TestQueues: { [key in TestQueue]: SqsConsumerOptions | SqsProducerOptions describe('SqsModule', () => { let module: TestingModule; - describe.skip('register', () => {}); - describe('registerAsync', () => { let module: TestingModule; @@ -78,17 +75,17 @@ describe('SqsModule', () => { @SqsMessageHandler(TestQueue.Test) // eslint-disable-next-line @typescript-eslint/no-empty-function - public async handleTestMessage(message: AWS.SQS.Message) { + public async handleTestMessage(message: Message) { fakeProcessor(message); } @SqsConsumerEventHandler(TestQueue.Test, 'processing_error') - public handleErrorEvent(err: Error, message: AWS.SQS.Message) { + public handleErrorEvent(err: Error, message: Message) { fakeErrorEventHandler(err, message); } @SqsMessageHandler(TestQueue.DLQ) - public async handleDLQMessage(message: AWS.SQS.Message) { + public async handleDLQMessage(message: Message) { fakeDLQProcessor(message); } }