mobiletto 1.0.45 → 1.0.46

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobiletto",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "description": "A storage abstraction layer",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -176,6 +176,16 @@ for (const driverName of DRIVER_NAMES) {
176
176
  const nonexistentFile = 'random_file_that_does_not_exist_' + rand(100) + '_' + Date.now()
177
177
  const tempFilename = (name, i) => name + (i > 0 ? '_' + i : '')
178
178
  describe(`${driverName} test`, () => {
179
+ beforeEach ((done) => {
180
+ redis.flushMobiletto().then(
181
+ () => { logger.info(`${driverName} - flushed redis`) },
182
+ (e) => {
183
+ logger.error(`${driverName} - error flushing redis: ${e}`)
184
+ throw e
185
+ }
186
+ ).finally(() => done())
187
+ })
188
+
179
189
  describe(`${driverName} - create api client`, () => {
180
190
  it("should validate the config and return an API object", async () => {
181
191
  const api = await mobiletto(driverName, config.key, config.secret, config.opts)
@@ -412,7 +422,6 @@ for (const driverName of DRIVER_NAMES) {
412
422
  }
413
423
  })
414
424
  it(`should mirror its subdirectory (${driverName}/${randomParent}) to another place (${mirrorDriver}/${mirrorDest})`, async () => {
415
- await redis.flushMobiletto()
416
425
  const results = await fixture.mirrorApi.mirror(fixture.api, mirrorDest, randomParent)
417
426
  expect(results).to.have.property('errors', 0, 'expected no errors in mirroring')
418
427
  expect(results).to.have.property('success').greaterThan(0, 'expected some successes in mirroring')
@@ -503,3 +512,14 @@ for (const driverName of DRIVER_NAMES) {
503
512
  })
504
513
  })
505
514
  }
515
+
516
+ after ((done) => {
517
+ try {
518
+ logger.info('all tests finished, tearing down redis...')
519
+ redis.teardown()
520
+ } catch (e) {
521
+ logger.warn(`error calling redis.teardown: ${e}`)
522
+ } finally {
523
+ done()
524
+ }
525
+ })
package/util/redis.js CHANGED
@@ -149,7 +149,7 @@ const scopedCache = (name, size = 100) => {
149
149
  teardown = () => {
150
150
  const redis = getRedis()
151
151
  if (redis) {
152
- redis.shutdown()
152
+ redis.disconnect()
153
153
  }
154
154
  }
155
155