From c9a6fb1a2acd0d16888d128b07e9343004a551d7 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 24 Jun 2016 10:52:38 -0500 Subject: [PATCH] remove nested describe, does not work as I thought --- test/cloudron-backup-test.js | 134 +++++++++++++++++------------------ 1 file changed, 64 insertions(+), 70 deletions(-) diff --git a/test/cloudron-backup-test.js b/test/cloudron-backup-test.js index 889dad6..d8022b1 100644 --- a/test/cloudron-backup-test.js +++ b/test/cloudron-backup-test.js @@ -66,64 +66,61 @@ describe('Cloudron backup testing', function () { cloudron.setCredentials(owner.password, token); }); - describe('mail tests as normal user', function () { - it('can send mail to cloudron user', function (done) { - mailer.sendMailToCloudronUser(owner.username + '@' + cloudron.fqdn(), done); - }); - - it('did receive mail', function (done) { - cloudron.checkMail(owner, done); - }); - - it('can send mail from cloudron user', function (done) { - cloudron.sendMail(owner, 'test+fromcloudron@cloudron.io', done); - }); - - it('did send mail from cloudron user', function (done) { - imap.probe({ - subject: new RegExp('^Hi from e2e test$'), - to: /test+fromcloudron@cloudron.io/, - body: /This release depends on you/ - }, done); - }); - - it('can save a sieve script', function (done) { - cloudron.saveSieveScript(owner, done); - }); + // mail tests as normal user + it('can send mail to cloudron user', function (done) { + mailer.sendMailToCloudronUser(owner.username + '@' + cloudron.fqdn(), done); }); - describe('mail alias tests', function () { - it('can set aliases', function () { - cloudron.setAliases(owner, ['admin', 'mail']); - }); - - it('can send email to alias', function (done) { - mailer.sendMailToCloudronUser('admin@' + box.domain, done); - }); - - it('did receive mail as alias (using owner name creds)', function (done) { - cloudron.checkMail(_.extend(owner, { to: 'admin' }), done); - }); - - it('did receive mail to alias (using alias creds)', function (done) { - cloudron.checkMail({ username: 'admin', password: owner.password, to: 'admin' }, done); - }); + it('did receive mail', function (done) { + cloudron.checkMail(owner, done); }); - describe('app pre-restore', function () { - var location = 'test' + (Math.random() * 10000).toFixed(); - it('can install app', function () { - var manifest = appStore.getManifest(common.TESTAPP_ID, common.TESTAPP_VERSION); - appId = cloudron.installApp(location, manifest); - }); + it('can send mail from cloudron user', function (done) { + cloudron.sendMail(owner, 'test+fromcloudron@cloudron.io', done); + }); - it('can populate the addons', function () { - cloudron.populateAddons(cloudron.appFqdn(location)); - }); + it('did send mail from cloudron user', function (done) { + imap.probe({ + subject: new RegExp('^Hi from e2e test$'), + to: /test+fromcloudron@cloudron.io/, + body: /This release depends on you/ + }, done); + }); - it('can check the addons', function () { - cloudron.checkAddons(cloudron.appFqdn(location), owner); - }); + it('can save a sieve script', function (done) { + cloudron.saveSieveScript(owner, done); + }); + + // mail alias tests + it('can set aliases', function () { + cloudron.setAliases(owner, ['admin', 'mail']); + }); + + it('can send email to alias', function (done) { + mailer.sendMailToCloudronUser('admin@' + box.domain, done); + }); + + it('did receive mail as alias (using owner name creds)', function (done) { + cloudron.checkMail(_.extend(owner, { to: 'admin' }), done); + }); + + it('did receive mail to alias (using alias creds)', function (done) { + cloudron.checkMail({ username: 'admin', password: owner.password, to: 'admin' }, done); + }); + + ////////////////////////// restore + var location = 'test' + (Math.random() * 10000).toFixed(); + it('can install app', function () { + var manifest = appStore.getManifest(common.TESTAPP_ID, common.TESTAPP_VERSION); + appId = cloudron.installApp(location, manifest); + }); + + it('can populate the addons', function () { + cloudron.populateAddons(cloudron.appFqdn(location)); + }); + + it('can check the addons', function () { + cloudron.checkAddons(cloudron.appFqdn(location), owner); }); it('can backup the box', function () { @@ -151,28 +148,25 @@ describe('Cloudron backup testing', function () { cloudron.setCredentials(owner.password, token); }); - describe('mail tests as normal user', function() { - it('retains old mail', function (done) { - cloudron.checkMail(owner, owner.username, done); - }); - - it('can check sieve script', function (done) { - cloudron.checkSieveScript(owner, done); - }); + // mail tests as normal user + it('retains old mail', function (done) { + cloudron.checkMail(owner, owner.username, done); }); - describe('app tests', function () { - it('wait for app', function () { - cloudron.waitForApp(appId); - }); + it('can check sieve script', function (done) { + cloudron.checkSieveScript(owner, done); + }); - it('can check the addons', function () { - cloudron.checkAddons(cloudron.appFqdn(location), owner); - }); + it('wait for app', function () { + cloudron.waitForApp(appId); + }); - it('can uninstall app', function () { - cloudron.uninstallApp(appId); - }); + it('can check the addons', function () { + cloudron.checkAddons(cloudron.appFqdn(location), owner); + }); + + it('can uninstall app', function () { + cloudron.uninstallApp(appId); }); it('can delete the cloudron', function () {