2016-08-07 23:02:53 -04:00
|
|
|
import AppCache from './cache';
|
2016-04-08 18:00:16 +01:00
|
|
|
|
2016-08-07 23:02:53 -04:00
|
|
|
//Used by tests
|
|
|
|
|
function destroyAllDataPermanently() {
|
|
|
|
|
if (!process.env.TESTING) {
|
|
|
|
|
throw 'Only supported in test environment';
|
|
|
|
|
}
|
|
|
|
|
return Promise.all(Object.keys(AppCache.cache).map(appId => {
|
|
|
|
|
const app = AppCache.get(appId);
|
|
|
|
|
if (app.databaseController) {
|
|
|
|
|
return app.databaseController.deleteEverything();
|
|
|
|
|
} else {
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
}
|
|
|
|
|
}));
|
2016-04-08 18:00:16 +01:00
|
|
|
}
|
|
|
|
|
|
2016-08-07 23:02:53 -04:00
|
|
|
export {
|
|
|
|
|
destroyAllDataPermanently
|
|
|
|
|
}
|