mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
Right now, when customers upgrade from free → paid or even pro → team, we simply redirect to the org billing page with a quick banner that vanishes after 3 seconds confirming the plan was changed. it’s quite unsatisfying and feels like a missed opportunity to display what the customer now unlocked and next steps. I want to especially highlight projects that are now upgradeable from nano → micro, but we can later expand and make the “next steps” smarter and do it context-based.
56 lines
2.1 KiB
TypeScript
56 lines
2.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { getMicroUpgradeRows } from './PlanUpgradeSuccess.utils'
|
|
import { createMockOrgProject } from '@/tests/helpers'
|
|
|
|
describe('getMicroUpgradeRows', () => {
|
|
const rowRefs = (rows: ReturnType<typeof getMicroUpgradeRows>) =>
|
|
rows.map(({ project, isUpgrading }) => ({ ref: project.ref, isUpgrading }))
|
|
|
|
it('lists running projects on Nano compute', () => {
|
|
const projects = [
|
|
createMockOrgProject({ ref: 'nano-active', computeSize: 'nano' }),
|
|
createMockOrgProject({ ref: 'micro-active', computeSize: 'micro' }),
|
|
createMockOrgProject({ ref: 'nano-paused', computeSize: 'nano', status: 'INACTIVE' }),
|
|
]
|
|
|
|
expect(rowRefs(getMicroUpgradeRows(projects, new Set()))).toEqual([
|
|
{ ref: 'nano-active', isUpgrading: false },
|
|
])
|
|
})
|
|
|
|
it('keeps an upgraded project listed while it resizes, then drops it once it runs on Micro', () => {
|
|
const requested = new Set(['upgraded'])
|
|
const resizing = createMockOrgProject({
|
|
ref: 'upgraded',
|
|
computeSize: 'micro',
|
|
status: 'RESIZING',
|
|
})
|
|
const done = createMockOrgProject({ ref: 'upgraded', computeSize: 'micro' })
|
|
|
|
expect(rowRefs(getMicroUpgradeRows([resizing], requested))).toEqual([
|
|
{ ref: 'upgraded', isUpgrading: true },
|
|
])
|
|
expect(getMicroUpgradeRows([done], requested)).toEqual([])
|
|
})
|
|
|
|
it('shows a resizing Nano project as upgrading, but not an unrelated resize on other compute', () => {
|
|
const projects = [
|
|
createMockOrgProject({ ref: 'nano-resizing', computeSize: 'nano', status: 'RESIZING' }),
|
|
createMockOrgProject({ ref: 'small-resizing', computeSize: 'small', status: 'RESIZING' }),
|
|
]
|
|
|
|
expect(rowRefs(getMicroUpgradeRows(projects, new Set()))).toEqual([
|
|
{ ref: 'nano-resizing', isUpgrading: true },
|
|
])
|
|
})
|
|
|
|
it('keeps a requested project upgrading when a stale response still reports it active on Nano', () => {
|
|
const stale = createMockOrgProject({ ref: 'upgraded', computeSize: 'nano' })
|
|
|
|
expect(rowRefs(getMicroUpgradeRows([stale], new Set(['upgraded'])))).toEqual([
|
|
{ ref: 'upgraded', isUpgrading: true },
|
|
])
|
|
})
|
|
})
|