1
0
mirror of https://git.cloudron.io/cloudron/gitea-app synced 2026-04-25 12:13:03 +00:00

test: pass cloudronCli.* methods directly as it() callbacks

Replaces `it('uninstall app', async () => { await cloudronCli.uninstall(); })`
style wrappers with the bare-method form `it('uninstall app',
cloudronCli.uninstall)` so mocha awaits the returned promise. Also fixes
sync `function () { cloudronCli.appstoreInstall(); }` wrappers around
async methods, where mocha would resolve the test before getAppInfo()
refreshed `app` and the next step would navigate to a stale fqdn.

Made-with: Cursor
This commit is contained in:
Girish Ramakrishnan
2026-04-24 17:54:00 +02:00
parent e73d6d68a5
commit adb5a3e683
+10 -26
View File
@@ -151,19 +151,13 @@ describe('Application life cycle test', function () {
it('can add and push a file', pushFile); it('can add and push a file', pushFile);
it('can restart app', function () { it('can restart app', cloudronCli.restart);
cloudronCli.restart();
});
it('can clone the url', cloneRepo); it('can clone the url', cloneRepo);
it('file exists in repo', fileExists); it('file exists in repo', fileExists);
it('backup app', async function () { it('backup app', cloudronCli.createBackup);
await cloudronCli.createBackup(); it('restore app', cloudronCli.restoreFromLatestBackup);
});
it('restore app', async function () {
await cloudronCli.restoreFromLatestBackup();
});
it('can login', loginGiteaOIDC); it('can login', loginGiteaOIDC);
it('can get avatar', checkAvatar); it('can get avatar', checkAvatar);
@@ -172,9 +166,7 @@ describe('Application life cycle test', function () {
assert.strictEqual(fs.existsSync(`${repodir}/newfile`), true); assert.strictEqual(fs.existsSync(`${repodir}/newfile`), true);
}); });
it('move to different location', async function () { it('move to different location', cloudronCli.changeLocation);
await cloudronCli.changeLocation();
});
it('can login', loginGiteaOIDC); it('can login', loginGiteaOIDC);
it('can get avatar', checkAvatar); it('can get avatar', checkAvatar);
@@ -183,9 +175,7 @@ describe('Application life cycle test', function () {
assert.strictEqual(fs.existsSync(`${repodir}/newfile`), true); assert.strictEqual(fs.existsSync(`${repodir}/newfile`), true);
}); });
it('uninstall app', async function () { it('uninstall app', cloudronCli.uninstall);
await cloudronCli.uninstall();
});
it('install app (no sso)', function () { it('install app (no sso)', function () {
cloudronCli.install({ noSso: true, tcpPortFlags: INSTALL_TCP_FLAGS }); cloudronCli.install({ noSso: true, tcpPortFlags: INSTALL_TCP_FLAGS });
@@ -194,12 +184,10 @@ describe('Application life cycle test', function () {
it('can admin login (no sso)', adminLogin); it('can admin login (no sso)', adminLogin);
it('can logout', logout); it('can logout', logout);
it('uninstall app (no sso)', async function () { it('uninstall app (no sso)', cloudronCli.uninstall);
await cloudronCli.uninstall();
});
it('can install app', function () { it('can install app', async function () {
cloudronCli.appstoreInstall({ tcpPortFlags: INSTALL_TCP_FLAGS }); await cloudronCli.appstoreInstall({ tcpPortFlags: INSTALL_TCP_FLAGS });
}); });
it('can login', loginGiteaOIDCOld); it('can login', loginGiteaOIDCOld);
@@ -210,9 +198,7 @@ describe('Application life cycle test', function () {
it('can clone the url', cloneRepo); it('can clone the url', cloneRepo);
it('can add and push a file', pushFile); it('can add and push a file', pushFile);
it('can update', async function () { it('can update', cloudronCli.update);
await cloudronCli.update();
});
it('can admin login', adminLogin); it('can admin login', adminLogin);
it('can logout', logout); it('can logout', logout);
@@ -222,7 +208,5 @@ describe('Application life cycle test', function () {
it('can clone the url', cloneRepo); it('can clone the url', cloneRepo);
it('file exists in cloned repo', fileExists); it('file exists in cloned repo', fileExists);
it('uninstall app', async function () { it('uninstall app', cloudronCli.uninstall);
await cloudronCli.uninstall();
});
}); });