Run migrations before clearing database during tests
This commit is contained in:
parent
01480f5dd2
commit
9065b647ad
1 changed files with 15 additions and 14 deletions
|
@ -66,18 +66,19 @@ before(function(done) {
|
|||
idbReq.onsuccess = function() { done(); };
|
||||
});
|
||||
|
||||
function clearDatabase(done) {
|
||||
var convos = new Whisper.ConversationCollection();
|
||||
return convos.fetch().then(function() {
|
||||
convos.destroyAll().then(function() {
|
||||
var messages = new Whisper.MessageCollection();
|
||||
return messages.fetch().then(function() {
|
||||
messages.destroyAll().then(function() {
|
||||
async function clearDatabase(done) {
|
||||
await Signal.Migrations.Migrations0DatabaseWithAttachmentData.run({
|
||||
Backbone,
|
||||
databaseName: Whisper.Database.id,
|
||||
});
|
||||
|
||||
const convos = new Whisper.ConversationCollection();
|
||||
await convos.fetch();
|
||||
await convos.destroyAll();
|
||||
const messages = new Whisper.MessageCollection();
|
||||
await messages.fetch();
|
||||
await messages.destroyAll();
|
||||
if (done) {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue