presidium 0.29.10 → 0.29.11
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/Dependency.js +3 -0
- package/Dependency.test.js +11 -0
- package/package.json +1 -1
package/Dependency.js
CHANGED
|
@@ -39,6 +39,9 @@ Dependency.teardown = async function teardown(dependency) {
|
|
|
39
39
|
dependency.close()
|
|
40
40
|
await dependency.delete()
|
|
41
41
|
}
|
|
42
|
+
else if (typeof dependency.destroy == 'function') {
|
|
43
|
+
await dependency.destroy()
|
|
44
|
+
}
|
|
42
45
|
|
|
43
46
|
dependency?.timers?.forEach(clearInterval)
|
|
44
47
|
}
|
package/Dependency.test.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const Test = require('thunk-test')
|
|
2
|
+
const assert = require('assert')
|
|
2
3
|
const DynamoTable = require('./DynamoTable')
|
|
3
4
|
const DynamoStream = require('./DynamoStream')
|
|
4
5
|
const ElasticsearchIndex = require('./ElasticsearchIndex')
|
|
@@ -48,12 +49,22 @@ const test = new Test('Dependency.teardown', async function () {
|
|
|
48
49
|
})
|
|
49
50
|
await myKinesisStream.ready
|
|
50
51
|
|
|
52
|
+
let didDestroyMyCache = false
|
|
53
|
+
const myCache = {
|
|
54
|
+
destroy() {
|
|
55
|
+
didDestroyMyCache = true
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
51
59
|
await Dependency.teardown(null)
|
|
52
60
|
await Dependency.teardown(myDynamoTable)
|
|
53
61
|
await Dependency.teardown(myDynamoStream)
|
|
54
62
|
await Dependency.teardown(myElasticsearchIndex)
|
|
55
63
|
await Dependency.teardown(myS3Bucket)
|
|
56
64
|
await Dependency.teardown(myKinesisStream)
|
|
65
|
+
await Dependency.teardown(myCache)
|
|
66
|
+
assert(didDestroyMyCache)
|
|
67
|
+
|
|
57
68
|
}).case()
|
|
58
69
|
|
|
59
70
|
if (process.argv[1] == __filename) {
|