[local-sync] Properly clean-up in-memory test database

Summary: There's no file to unlink, we just need to drop the tables.

Test Plan: manual

Reviewers: evan, juan

Reviewed By: evan, juan

Differential Revision: https://phab.nylas.com/D3878
This commit is contained in:
Halla Moore 2017-02-10 15:22:27 -08:00
parent e646d56bf8
commit 2d3bb52bc8

View file

@ -65,6 +65,14 @@ class LocalDatabaseConnector {
}
destroyAccountDatabase(accountId) {
if (NylasEnv.inSpecMode()) {
// The db is in memory, so we don't have to unlink it. Just drop the data.
return this.forAccount(accountId).then(db => {
delete this._cache[accountId];
return db.sequelize.drop()
});
}
const dbname = `a-${accountId}`;
const dbpath = path.join(process.env.NYLAS_HOME, `${dbname}.sqlite`);
@ -78,6 +86,7 @@ class LocalDatabaseConnector {
}
delete this._cache[accountId];
return Promise.resolve();
}
_sequelizeForShared() {