aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/migrator-test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/migrator-test.js')
-rw-r--r--test/unit/migrator-test.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/unit/migrator-test.js b/test/unit/migrator-test.js
index 2bad7da51..4404e1dc4 100644
--- a/test/unit/migrator-test.js
+++ b/test/unit/migrator-test.js
@@ -50,11 +50,19 @@ describe('Migrator', () => {
const migrator = new Migrator({ migrations: liveMigrations })
migrator.migrateData(firstTimeState)
.then((migratedData) => {
- console.log(migratedData)
const last = liveMigrations.length - 1
assert.equal(migratedData.meta.version, liveMigrations[last].version)
done()
}).catch(done)
})
+ it('should emit an error', function (done) {
+ this.timeout(15000)
+ const migrator = new Migrator({ migrations: [{ version: 1, migrate: async () => { throw new Error('test') } } ] })
+ migrator.on('error', () => done())
+ migrator.migrateData({ meta: {version: 0} })
+ .then((migratedData) => {
+ }).catch(done)
+ })
+
})