merge appdb.js into apps.js
This commit is contained in:
+11
-23
@@ -23,20 +23,16 @@ describe('Appstore', function () {
|
||||
|
||||
beforeEach(nock.cleanAll);
|
||||
|
||||
it('can purchase an app', function (done) {
|
||||
it('can purchase an app', async function () {
|
||||
const scope1 = nock(mockApiServerOrigin)
|
||||
.post(`/api/v1/cloudronapps?accessToken=${appstoreToken}`, function () { return true; })
|
||||
.reply(201, {});
|
||||
|
||||
appstore.purchaseApp({ appId: APP_ID, appstoreId: APPSTORE_APP_ID, manifestId: APPSTORE_APP_ID }, function (error) {
|
||||
expect(error).to.not.be.ok();
|
||||
expect(scope1.isDone()).to.be.ok();
|
||||
|
||||
done();
|
||||
});
|
||||
await appstore.purchaseApp({ appId: APP_ID, appstoreId: APPSTORE_APP_ID, manifestId: APPSTORE_APP_ID });
|
||||
expect(scope1.isDone()).to.be.ok();
|
||||
});
|
||||
|
||||
it('unpurchase succeeds if app was never purchased', function (done) {
|
||||
it('unpurchase succeeds if app was never purchased', async function () {
|
||||
const scope1 = nock(mockApiServerOrigin)
|
||||
.get(`/api/v1/cloudronapps/${APP_ID}?accessToken=${appstoreToken}`)
|
||||
.reply(404, {});
|
||||
@@ -45,16 +41,12 @@ describe('Appstore', function () {
|
||||
.delete(`/api/v1/cloudronapps/${APP_ID}?accessToken=${appstoreToken}`, function () { return true; })
|
||||
.reply(204, {});
|
||||
|
||||
appstore.unpurchaseApp(APP_ID, { appstoreId: APPSTORE_APP_ID, manifestId: APPSTORE_APP_ID }, function (error) {
|
||||
expect(error).to.not.be.ok();
|
||||
expect(scope1.isDone()).to.be.ok();
|
||||
expect(scope2.isDone()).to.not.be.ok();
|
||||
|
||||
done();
|
||||
});
|
||||
await appstore.unpurchaseApp(APP_ID, { appstoreId: APPSTORE_APP_ID, manifestId: APPSTORE_APP_ID });
|
||||
expect(scope1.isDone()).to.be.ok();
|
||||
expect(scope2.isDone()).to.not.be.ok();
|
||||
});
|
||||
|
||||
it('can unpurchase an app', function (done) {
|
||||
it('can unpurchase an app', async function () {
|
||||
const scope1 = nock(mockApiServerOrigin)
|
||||
.get(`/api/v1/cloudronapps/${APP_ID}?accessToken=${appstoreToken}`)
|
||||
.reply(200, {});
|
||||
@@ -63,12 +55,8 @@ describe('Appstore', function () {
|
||||
.delete(`/api/v1/cloudronapps/${APP_ID}?accessToken=${appstoreToken}`, function () { return true; })
|
||||
.reply(204, {});
|
||||
|
||||
appstore.unpurchaseApp(APP_ID, { appstoreId: APPSTORE_APP_ID, manifestId: APPSTORE_APP_ID }, function (error) {
|
||||
expect(error).to.not.be.ok();
|
||||
expect(scope1.isDone()).to.be.ok();
|
||||
expect(scope2.isDone()).to.be.ok();
|
||||
|
||||
done();
|
||||
});
|
||||
await appstore.unpurchaseApp(APP_ID, { appstoreId: APPSTORE_APP_ID, manifestId: APPSTORE_APP_ID });
|
||||
expect(scope1.isDone()).to.be.ok();
|
||||
expect(scope2.isDone()).to.be.ok();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user