(fast)
| 6 | * @param {boolean} fast set to true if it's ok to just drop objects and not indexes. |
| 7 | */ |
| 8 | export function destroyAllDataPermanently(fast) { |
| 9 | if (!process.env.TESTING) { |
| 10 | throw 'Only supported in test environment'; |
| 11 | } |
| 12 | return Promise.all( |
| 13 | Object.keys(AppCache.cache).map(appId => { |
| 14 | const app = AppCache.get(appId); |
| 15 | const deletePromises = []; |
| 16 | if (app.cacheAdapter && app.cacheAdapter.clear) { |
| 17 | deletePromises.push(app.cacheAdapter.clear()); |
| 18 | } |
| 19 | if (app.databaseController) { |
| 20 | deletePromises.push(app.databaseController.deleteEverything(fast)); |
| 21 | } else if (app.databaseAdapter) { |
| 22 | SchemaCache.clear(); |
| 23 | deletePromises.push(app.databaseAdapter.deleteAllClasses(fast)); |
| 24 | } |
| 25 | return Promise.all(deletePromises); |
| 26 | }) |
| 27 | ); |
| 28 | } |
| 29 | |
| 30 | export function resolvingPromise() { |
| 31 | let res; |
no test coverage detected