Files
supabase/apps/studio/components/interfaces/Support/FreeMicroUpgradeSuggestion.utils.test.ts
K-Dog (Kevin) 57628c6de0 chore: Free Micro upgrade when filing a performance ticket (#53848)
If a user selects the "Performance" category on the support ticket form
and their project ref maps to a Nano project on a paid plan, show an
inline tip in the form itself, before submission, pointing to a
troubleshooting guide covering the free Micro upgrade and the usual perf
debugging steps (query optimization, advisors, etc.).

<img width="523" height="327" alt="Screenshot 2026-11-23 at 6 56 05 PM"
src="https://github.com/user-attachments/assets/b0b69866-3e34-443a-8405-23279e07e25c"
/>
2026-11-24 12:31:54 +08:00

23 lines
951 B
TypeScript

import { describe, expect, it } from 'vitest'
import { isEligibleForFreeMicroUpgrade } from './FreeMicroUpgradeSuggestion.utils'
describe('isEligibleForFreeMicroUpgrade', () => {
it.each(['pro', 'team', 'enterprise'] as const)('is eligible for nano on %s', (planId) => {
expect(isEligibleForFreeMicroUpgrade({ planId, computeSize: 'nano' })).toBe(true)
})
it('is not eligible on the free plan', () => {
expect(isEligibleForFreeMicroUpgrade({ planId: 'free', computeSize: 'nano' })).toBe(false)
})
it('is not eligible on larger compute sizes', () => {
expect(isEligibleForFreeMicroUpgrade({ planId: 'pro', computeSize: 'micro' })).toBe(false)
})
it('is not eligible while the plan or compute size is unknown', () => {
expect(isEligibleForFreeMicroUpgrade({ planId: undefined, computeSize: 'nano' })).toBe(false)
expect(isEligibleForFreeMicroUpgrade({ planId: 'pro', computeSize: undefined })).toBe(false)
})
})