Skip to content
This repository was archived by the owner on Oct 1, 2023. It is now read-only.

Commit bc14243

Browse files
committed
Fix CI
1 parent eccc668 commit bc14243

File tree

6 files changed

+17
-15
lines changed

6 files changed

+17
-15
lines changed

.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ module.exports = {
99
'plugin:@typescript-eslint/eslint-recommended',
1010
'plugin:@typescript-eslint/recommended',
1111
'prettier',
12-
'prettier/@typescript-eslint',
1312
],
1413
root: true,
1514
env: {

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
node-version: [12.x, 14.x, 16.x]
10+
node-version: [16.x]
1111
services:
1212
elasticmq:
1313
image: s12v/elasticmq

.vscode/settings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"typescript.tsdk": "node_modules/typescript/lib"
3-
}
2+
"typescript.tsdk": "node_modules/typescript/lib",
3+
"editor.formatOnPaste": true
4+
}

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
elasticmq:
2+
docker rm -f elasticmq; docker run -d -p 9324:9324 --mount type=bind,source=$(shell pwd)/.github/build/elasticmq.conf,target=/etc/elasticmq/elasticmq.conf --name elasticmq s12v/elasticmq
3+
e2e-test:
4+
npm run test:e2e

e2e/module.e2e-spec.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@ import { SqsModule, SqsService } from '../lib';
33
import { SqsConsumerOptions, SqsProducerOptions } from '../lib/sqs.types';
44
import { Injectable } from '@nestjs/common';
55
import { SqsConsumerEventHandler, SqsMessageHandler } from '../lib/sqs.decorators';
6-
import * as AWS from 'aws-sdk';
7-
import { promisify } from 'util';
86
import waitForExpect from 'wait-for-expect';
7+
import { Message, SQSClient as SQS } from '@aws-sdk/client-sqs';
98

10-
const delay = promisify(setTimeout);
119
const SQS_ENDPOINT = process.env.SQS_ENDPOINT || 'http://localhost:9324';
1210

1311
enum TestQueue {
1412
Test = 'test',
1513
DLQ = 'test-dead',
1614
}
1715

18-
const sqs = new AWS.SQS({
16+
const sqs = new SQS({
1917
apiVersion: '2012-11-05',
20-
credentials: new AWS.Credentials('x', 'x'),
18+
credentials: { accessKeyId: 'x', secretAccessKey: 'x'},
19+
endpoint: SQS_ENDPOINT,
2120
region: 'none',
2221
});
2322

@@ -37,8 +36,6 @@ const TestQueues: { [key in TestQueue]: SqsConsumerOptions | SqsProducerOptions
3736
describe('SqsModule', () => {
3837
let module: TestingModule;
3938

40-
describe.skip('register', () => {});
41-
4239
describe('registerAsync', () => {
4340
let module: TestingModule;
4441

@@ -78,17 +75,17 @@ describe('SqsModule', () => {
7875

7976
@SqsMessageHandler(TestQueue.Test)
8077
// eslint-disable-next-line @typescript-eslint/no-empty-function
81-
public async handleTestMessage(message: AWS.SQS.Message) {
78+
public async handleTestMessage(message: Message) {
8279
fakeProcessor(message);
8380
}
8481

8582
@SqsConsumerEventHandler(TestQueue.Test, 'processing_error')
86-
public handleErrorEvent(err: Error, message: AWS.SQS.Message) {
83+
public handleErrorEvent(err: Error, message: Message) {
8784
fakeErrorEventHandler(err, message);
8885
}
8986

9087
@SqsMessageHandler(TestQueue.DLQ)
91-
public async handleDLQMessage(message: AWS.SQS.Message) {
88+
public async handleDLQMessage(message: Message) {
9289
fakeDLQProcessor(message);
9390
}
9491
}

lib/sqs-producer/producer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ export class Producer {
6464
});
6565

6666
const result = await this.sqs.send(params);
67-
const failedMessagesBatch = failedMessages.concat(result.Failed.map((entry) => entry.Id));
67+
const failed = result.Failed ?? []
68+
const failedMessagesBatch = failedMessages.concat(failed.map((entry) => entry.Id));
6869
const successfulMessagesBatch = successfulMessages.concat(result.Successful);
6970

7071
if (endIndex < messages.length) {

0 commit comments

Comments
 (0)