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

Updated email-notifier to use Jest for testing. #75

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 1 addition & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,12 @@ jobs:
<<: *defaults_environment
- restore_cache:
key: dependency-cache-{{ checksum "CACHE_VERSION.txt" }}-{{ checksum "package.json" }}
- run:
name: Install tape, tapes and tap-xunit
command: npm install -g tape tapes tap-xunit
- run:
name: Create dir for test results
command: mkdir -p ./test/results
- run:
name: Execute unit tests
command: npm -s run test:xunit > ./test/results/tape.xml
command: JEST_JUNIT_OUTPUT_DIR='./test/results' JEST_JUNIT_OUTPUT_NAME='junit.xml' npm run test:junit
- store_artifacts:
path: ./test/results
prefix: test
Expand Down
95 changes: 95 additions & 0 deletions config/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"_emailSettings": {
"smtpConfig": {
"host": "smtp-relay.sendinblue.com",
"port": 587,
"secureConnection": false,
"tls": {
"ciphers": "SSLv3"
},
"auth": {
"user": "testing@modusbox.com",
"pass": "testing"
}
}
},
"PORT": 3081,
"KAFKA": {
"TOPIC_TEMPLATES": {
"NOTIFICATION_TOPIC_TEMPLATE": {
"TEMPLATE": "topic-notification-event",
"REGEX": "topic-notification-event"
},
"GENERAL_TOPIC_TEMPLATE": {
"TEMPLATE": "topic-{{functionality}}-{{action}}",
"REGEX": "topic-(.*)-(.*)"
}
},
"CONSUMER": {
"NOTIFICATION": {
"EVENT": {
"config": {
"options": {
"mode": 2,
"batchSize": 1,
"recursiveTimeout": 100,
"messageCharset": "utf8",
"messageAsJSON": true,
"sync": true,
"consumeTimeout": 1000
},
"rdkafkaConf": {
"client.id": "enotifier-con",
"group.id": "enotifier-group",
"metadata.broker.list": "localhost:9092",
"socket.blocking.max.ms": 1,
"fetch.wait.max.ms": 1,
"fetch.error.backoff.ms": 1,
"queue.buffering.max.ms": 1,
"broker.version.fallback": "0.10.1.0",
"api.version.request": true,
"enable.auto.commit": false,
"auto.commit.interval.ms": 200,
"socket.keepalive.enable": true,
"socket.max.fails": 1
},
"topicConf": {
"auto.offset.reset": "earliest"
}
}
}
}
},
"PRODUCER": {
"NOTIFICATION": {
"EVENT": {
"config": {
"options": {
"messageCharset": "utf8"
},
"rdkafkaConf": {
"debug": "all",
"metadata.broker.list": "localhost:9092",
"client.id": "enotifier-prod",
"event_cb": true,
"compression.codec": "none",
"retry.backoff.ms": 100,
"message.send.max.retries": 2,
"socket.keepalive.enable": true,
"queue.buffering.max.messages": 10000000,
"batch.num.messages": 100,
"dr_cb": true,
"socket.blocking.max.ms": 1,
"queue.buffering.max.ms": 1,
"broker.version.fallback": "0.10.1.0",
"api.version.request": true
}
}
}
}
}
},
"HUB_PARTICIPANT": {
"NAME": "Hub"
}
}
14 changes: 14 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
verbose: true,
collectCoverageFrom: [
'**/src/**/**/*.js'
],
coverageThreshold: {
global: {
statements: 90,
functions: 90,
branches: 90,
lines: 90
}
}
}
Loading