Skip to content

Commit 5ac16d0

Browse files
committed
Updated email-notifier to use Jest for testing.
1 parent d02ca53 commit 5ac16d0

23 files changed

Lines changed: 8187 additions & 6615 deletions

‎.circleci/config.yml‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,12 @@ jobs:
185185
<<: *defaults_environment
186186
- restore_cache:
187187
key: dependency-cache-{{ checksum "CACHE_VERSION.txt" }}-{{ checksum "package.json" }}
188-
- run:
189-
name: Install tape, tapes and tap-xunit
190-
command: npm install -g tape tapes tap-xunit
191188
- run:
192189
name: Create dir for test results
193190
command: mkdir -p ./test/results
194191
- run:
195192
name: Execute unit tests
196-
command: npm -s run test:xunit > ./test/results/tape.xml
193+
command: JEST_JUNIT_OUTPUT_DIR='./test/results' JEST_JUNIT_OUTPUT_NAME='junit.xml' npm run test:junit
197194
- store_artifacts:
198195
path: ./test/results
199196
prefix: test

‎config/test.json‎

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
"_emailSettings": {
3+
"smtpConfig": {
4+
"host": "smtp-relay.sendinblue.com",
5+
"port": 587,
6+
"secureConnection": false,
7+
"tls": {
8+
"ciphers": "SSLv3"
9+
},
10+
"auth": {
11+
"user": "testing@modusbox.com",
12+
"pass": "testing"
13+
}
14+
}
15+
},
16+
"PORT": 3081,
17+
"KAFKA": {
18+
"TOPIC_TEMPLATES": {
19+
"NOTIFICATION_TOPIC_TEMPLATE": {
20+
"TEMPLATE": "topic-notification-event",
21+
"REGEX": "topic-notification-event"
22+
},
23+
"GENERAL_TOPIC_TEMPLATE": {
24+
"TEMPLATE": "topic-{{functionality}}-{{action}}",
25+
"REGEX": "topic-(.*)-(.*)"
26+
}
27+
},
28+
"CONSUMER": {
29+
"NOTIFICATION": {
30+
"EVENT": {
31+
"config": {
32+
"options": {
33+
"mode": 2,
34+
"batchSize": 1,
35+
"recursiveTimeout": 100,
36+
"messageCharset": "utf8",
37+
"messageAsJSON": true,
38+
"sync": true,
39+
"consumeTimeout": 1000
40+
},
41+
"rdkafkaConf": {
42+
"client.id": "enotifier-con",
43+
"group.id": "enotifier-group",
44+
"metadata.broker.list": "localhost:9092",
45+
"socket.blocking.max.ms": 1,
46+
"fetch.wait.max.ms": 1,
47+
"fetch.error.backoff.ms": 1,
48+
"queue.buffering.max.ms": 1,
49+
"broker.version.fallback": "0.10.1.0",
50+
"api.version.request": true,
51+
"enable.auto.commit": false,
52+
"auto.commit.interval.ms": 200,
53+
"socket.keepalive.enable": true,
54+
"socket.max.fails": 1
55+
},
56+
"topicConf": {
57+
"auto.offset.reset": "earliest"
58+
}
59+
}
60+
}
61+
}
62+
},
63+
"PRODUCER": {
64+
"NOTIFICATION": {
65+
"EVENT": {
66+
"config": {
67+
"options": {
68+
"messageCharset": "utf8"
69+
},
70+
"rdkafkaConf": {
71+
"debug": "all",
72+
"metadata.broker.list": "localhost:9092",
73+
"client.id": "enotifier-prod",
74+
"event_cb": true,
75+
"compression.codec": "none",
76+
"retry.backoff.ms": 100,
77+
"message.send.max.retries": 2,
78+
"socket.keepalive.enable": true,
79+
"queue.buffering.max.messages": 10000000,
80+
"batch.num.messages": 100,
81+
"dr_cb": true,
82+
"socket.blocking.max.ms": 1,
83+
"queue.buffering.max.ms": 1,
84+
"broker.version.fallback": "0.10.1.0",
85+
"api.version.request": true
86+
}
87+
}
88+
}
89+
}
90+
}
91+
},
92+
"HUB_PARTICIPANT": {
93+
"NAME": "Hub"
94+
}
95+
}

‎jest.config.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
verbose: true,
3+
collectCoverageFrom: [
4+
'**/src/**/**/*.js'
5+
],
6+
coverageThreshold: {
7+
global: {
8+
statements: 90,
9+
functions: 90,
10+
branches: 90,
11+
lines: 90
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)