Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat [ notifier ]: new notification pattern #326

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions jest.setup.redis-mock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
const { GenericContainer } = require('testcontainers');

let redisTestContainer;

/**
* Mock redis library
* Create test container with Redis, which could be used in tests
*/
jest.mock('redis', () => jest.requireActual('redis-mock'));
beforeAll(async () => {
redisTestContainer = await new GenericContainer('redis')
.withExposedPorts(6379)
.start();

const port = redisTestContainer.getMappedPort(6379);
const host = redisTestContainer.getContainerIpAddress();

/**
* Set environment variable for redisHelper to connect to redis container
*/
process.env.REDIS_URL = `redis://${host}:${port}`;
}
);

afterAll(async () => {
await redisTestContainer.stop();
});
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,18 @@
"typescript": "^3.8.3",
"uuid": "^8.3.0",
"winston": "^3.2.1",
"yup": "^0.28.5"
"yup": "^0.28.5",
"@types/redis": "^2.8.28",
"redis": "^4.7.0"
},
"devDependencies": {
"@shelf/jest-mongodb": "^1.2.3",
"testcontainers": "^3.0.0",
"eslint": "^7.14.0",
"eslint-config-codex": "^1.6.1",
"jest": "25.5.4",
"nodemon": "^2.0.3",
"random-words": "^1.1.1",
"redis-mock": "^0.56.3",
"ts-jest": "25.4.0",
"wait-for-expect": "^3.0.2",
"webpack": "^4.43.0",
Expand Down
2 changes: 2 additions & 0 deletions workers/notifier/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Url for connecting to Redis
REDIS_URL=redis://redis:6379
6 changes: 5 additions & 1 deletion workers/notifier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
"version": "1.0.0",
"main": "src/index.ts",
"license": "MIT",
"workerType": "notifier"
"workerType": "notifier",
"dependencies": {
"@types/redis": "^2.8.28",
"redis": "^4.7.0"
}
}
270 changes: 0 additions & 270 deletions workers/notifier/src/buffer.ts

This file was deleted.

Loading
Loading