Update package.json + remove license.manage.spec.ts
Update package.json - Updating "test:self:ci" - Now includes license. Needed to prevent license tests from running where an account portal is not setup Removing license.manage.spec.ts - This will be included in another PR - Work required to finish this test - Removing so the license activation test can be merged
This commit is contained in:
parent
7505b90eea
commit
570eaa8e53
|
@ -17,7 +17,7 @@
|
|||
"test:notify": "node scripts/testResultsWebhook",
|
||||
"test:cloud:prod": "yarn run test --testPathIgnorePatterns=\\.integration\\.",
|
||||
"test:cloud:qa": "yarn run test",
|
||||
"test:self:ci": "yarn run test --testPathIgnorePatterns=\\.integration\\. \\.cloud\\.",
|
||||
"test:self:ci": "yarn run test --testPathIgnorePatterns=\\.integration\\. \\.cloud\\. \\.license\\.",
|
||||
"serve:test:self:ci": "start-server-and-test dev:built http://localhost:4001/health test:self:ci",
|
||||
"serve": "start-server-and-test dev:built http://localhost:4001/health",
|
||||
"dev:built": "cd ../ && yarn dev:built"
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
import TestConfiguration from "../../config/TestConfiguration"
|
||||
import * as fixtures from "../../fixtures"
|
||||
import { Hosting, PlanType } from "@budibase/types"
|
||||
|
||||
describe("license management", () => {
|
||||
const config = new TestConfiguration()
|
||||
|
||||
beforeAll(async () => {
|
||||
await config.beforeAll()
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await config.afterAll()
|
||||
})
|
||||
|
||||
it("retrieves plans, creates checkout session, and updates license", async () => {
|
||||
// Create cloud account
|
||||
const createAccountRequest = fixtures.accounts.generateAccount({
|
||||
hosting: Hosting.CLOUD,
|
||||
})
|
||||
|
||||
// Self response has free license
|
||||
const [selfRes, selfBody] = await config.api.accounts.self()
|
||||
expect(selfBody.license.plan.type).toBe(PlanType.FREE)
|
||||
|
||||
// Retrieve plans
|
||||
const [plansRes, planBody] = await config.api.licenses.getPlans()
|
||||
|
||||
// Select priceId from premium plan
|
||||
let premiumPriceId = null
|
||||
for (const plan of planBody) {
|
||||
if (plan.type === PlanType.PREMIUM) {
|
||||
premiumPriceId = plan.prices[0].priceId
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Create checkout session for price
|
||||
const checkoutSessionRes = await config.api.stripe.createCheckoutSession(
|
||||
premiumPriceId
|
||||
)
|
||||
const checkoutSessionUrl = checkoutSessionRes[1].url
|
||||
expect(checkoutSessionUrl).toContain("checkout.stripe.com")
|
||||
|
||||
// TODO: Mimic checkout success
|
||||
// Create stripe customer
|
||||
// Create subscription for premium plan
|
||||
// Assert license updated from free to premium
|
||||
|
||||
// Create portal session
|
||||
//await config.api.stripe.createPortalSession()
|
||||
|
||||
// Update from free to business license
|
||||
|
||||
// License updated
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue