Fix tests

This commit is contained in:
Girish Ramakrishnan
2025-10-07 09:34:35 +02:00
parent 3a0febe760
commit 6869380500
4 changed files with 28 additions and 5 deletions
+11 -3
View File
@@ -122,21 +122,31 @@ describe('Provision', function () {
});
describe('Activation', function () {
let scope1, scope2;
let scope1, scope2, scope3;
before(async function () {
// IMPORTANT: a quirk in provision is that it always registers cloudron even before validation of the owner fields (like username)
// this means that fail tests below call the appstore API many times and thus the times(1000)
scope1 = nock(await appstore.getApiServerOrigin())
.post('/api/v1/register_cloudron3', (body) => typeof body.domain === 'string' && typeof body.version === 'string')
.times(1000)
.reply(201, { cloudronId: '32', cloudronToken: 'xx' });
scope2 = nock(await appstore.getApiServerOrigin())
.post('/api/v1/subscription3?accessToken=xx', (body) => typeof body.state === 'object' && typeof body.state.userCount === 'number')
.times(1000)
.reply(200, { features: {} });
scope3 = nock(await appstore.getApiServerOrigin())
.post('/api/v1/update_cloudron?accessToken=xx', (body) => typeof body.domain === 'string' && typeof body.version === 'string')
.times(1000)
.reply(200, {});
});
after(function () {
scope1.persist(false);
scope2.persist(false);
scope3.persist(false);
nock.cleanAll();
});
@@ -169,8 +179,6 @@ describe('Provision', function () {
.send({ username: '', password: owner.password, email: owner.email })
.ok(() => true);
console.log(response.body);
expect(response.status).to.eql(400);
});