@adaptivestone/framework 3.4.2 → 3.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/tests/setup.js +11 -5
package/package.json
CHANGED
package/tests/setup.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
const path = require('node:path');
|
|
1
2
|
/* eslint-disable jest/require-top-level-describe */
|
|
2
3
|
const { MongoMemoryReplSet } = require('mongodb-memory-server');
|
|
3
4
|
const mongoose = require('mongoose');
|
|
4
5
|
|
|
5
6
|
let mongoMemoryServerInstance;
|
|
6
|
-
|
|
7
|
+
|
|
7
8
|
const redis = require('redis');
|
|
8
9
|
const Server = require('../server');
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
+
const clearRedisNamespace = require('../helpers/redis/clearNamespace');
|
|
11
12
|
|
|
12
13
|
jest.setTimeout(1000000);
|
|
13
14
|
beforeAll(async () => {
|
|
@@ -29,6 +30,7 @@ beforeAll(async () => {
|
|
|
29
30
|
models: process.env.TEST_FOLDER_MODELS || path.resolve('./models'),
|
|
30
31
|
emails:
|
|
31
32
|
process.env.TEST_FOLDER_EMAIL ||
|
|
33
|
+
process.env.TEST_FOLDER_EMAILS ||
|
|
32
34
|
path.resolve('./services/messaging/email/templates'),
|
|
33
35
|
locales: process.env.TEST_FOLDER_LOCALES || path.resolve('./locales'),
|
|
34
36
|
commands: process.env.TEST_FOLDER_COMMANDS || path.resolve('./commands'),
|
|
@@ -81,9 +83,13 @@ afterEach(async () => {
|
|
|
81
83
|
const { url, namespace } = global.server.getConfig('redis');
|
|
82
84
|
const redisClient = redis.createClient({ url });
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
try {
|
|
87
|
+
await redisClient.connect();
|
|
88
|
+
await clearRedisNamespace(redisClient, namespace);
|
|
89
|
+
await redisClient.disconnect();
|
|
90
|
+
} catch (err) {
|
|
91
|
+
// that ok. No redis connection
|
|
92
|
+
}
|
|
87
93
|
}
|
|
88
94
|
});
|
|
89
95
|
|