Merge pull request #12972 from Budibase/qa-core-changes
QA Core License Test Update
This commit is contained in:
commit
94f7d385e1
|
@ -11,12 +11,12 @@ export default class StripeAPI extends BaseAPI {
|
|||
}
|
||||
|
||||
async createCheckoutSession(
|
||||
priceId: string,
|
||||
price: object,
|
||||
opts: APIRequestOpts = { status: 200 }
|
||||
) {
|
||||
return this.doRequest(() => {
|
||||
return this.client.post(`/api/stripe/checkout-session`, {
|
||||
body: { priceId },
|
||||
body: { prices: [price] },
|
||||
})
|
||||
}, opts)
|
||||
}
|
||||
|
|
|
@ -36,11 +36,11 @@ describe("license management", () => {
|
|||
const [plansRes, planBody] = await config.api.licenses.getPlans()
|
||||
|
||||
// Select priceId from premium plan
|
||||
let premiumPriceId = null
|
||||
let businessPriceId = ""
|
||||
let premiumPrice = null
|
||||
let businessPriceId: ""
|
||||
for (const plan of planBody) {
|
||||
if (plan.type === PlanType.PREMIUM_PLUS) {
|
||||
premiumPriceId = plan.prices[0].priceId
|
||||
premiumPrice = plan.prices[0]
|
||||
}
|
||||
if (plan.type === PlanType.ENTERPRISE_BASIC) {
|
||||
businessPriceId = plan.prices[0].priceId
|
||||
|
@ -48,9 +48,10 @@ describe("license management", () => {
|
|||
}
|
||||
|
||||
// Create checkout session for price
|
||||
const checkoutSessionRes = await config.api.stripe.createCheckoutSession(
|
||||
premiumPriceId
|
||||
)
|
||||
const checkoutSessionRes = await config.api.stripe.createCheckoutSession({
|
||||
id: premiumPrice.priceId,
|
||||
type: premiumPrice.type,
|
||||
})
|
||||
const checkoutSessionUrl = checkoutSessionRes[1].url
|
||||
expect(checkoutSessionUrl).toContain("checkout.stripe.com")
|
||||
|
||||
|
@ -84,7 +85,7 @@ describe("license management", () => {
|
|||
customer: customer.id,
|
||||
items: [
|
||||
{
|
||||
price: premiumPriceId,
|
||||
price: premiumPrice.priceId,
|
||||
quantity: 1,
|
||||
},
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue