mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
## What kind of change does this PR introduce? Copy/label update in Studio's compute surfaces. ## Description Compute CPU descriptions now branch on the compute size tier: - Sizes below Large read **"Shared compute"** (no core count) - Large and up read **"Dedicated · N vCPUs"** — the unit is always vCPU Changes: - New `lib/compute-labels.ts` helper (`isSharedComputeSize`, `getComputeCpuLabel`) with unit tests - Compute badge hover card, compute size picker, and project-creation selector use the new labels - `new-project.constants.ts` cpu strings updated accordingly - ">16XL" card: "Custom CPU" → "Custom compute"; upsell copy now says "64 vCPUs" - The synthetic Nano/Micro addon `meta` no longer has `cpu_cores`/`cpu_dedicated`; removed the now-unused cpu fields from the hardcoded instance specs - Project-creation sub-text: "Larger, dedicated compute available after creation" ## Tests - New unit tests for the label helper - Infrastructure settings page test now asserts the rendered labels Fixes PROD-663 Related #49998 #49996 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **User Interface** * Updated compute-size labels to use “Shared compute” and vCPU terminology. * Clarified dedicated compute options and availability messaging. * Updated custom instance and upgrade labels, including “Custom compute” and “64 vCPUs.” * **Consistency** * Standardized compute labels across project creation, infrastructure settings, and compute details. * **Tests** * Added coverage verifying shared and dedicated compute classifications and displayed labels. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
43 lines
1.6 KiB
TypeScript
43 lines
1.6 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { getComputeCpuLabel, isSharedComputeSize } from './compute-labels'
|
|
|
|
describe('isSharedComputeSize', () => {
|
|
it('treats sizes below Large as shared', () => {
|
|
expect(isSharedComputeSize('pico')).toBe(true)
|
|
expect(isSharedComputeSize('nano')).toBe(true)
|
|
expect(isSharedComputeSize('micro')).toBe(true)
|
|
expect(isSharedComputeSize('small')).toBe(true)
|
|
expect(isSharedComputeSize('medium')).toBe(true)
|
|
})
|
|
|
|
it('treats Large and up as dedicated', () => {
|
|
expect(isSharedComputeSize('large')).toBe(false)
|
|
expect(isSharedComputeSize('xlarge')).toBe(false)
|
|
expect(isSharedComputeSize('16xlarge')).toBe(false)
|
|
expect(isSharedComputeSize('48xlarge_high_memory')).toBe(false)
|
|
})
|
|
|
|
it('accepts addon variant identifiers and mixed case', () => {
|
|
expect(isSharedComputeSize('ci_micro')).toBe(true)
|
|
expect(isSharedComputeSize('ci_large')).toBe(false)
|
|
expect(isSharedComputeSize('Medium')).toBe(true)
|
|
})
|
|
})
|
|
|
|
describe('getComputeCpuLabel', () => {
|
|
it('labels shared sizes without a count', () => {
|
|
expect(getComputeCpuLabel('micro', 2)).toBe('Shared compute')
|
|
expect(getComputeCpuLabel('medium')).toBe('Shared compute')
|
|
})
|
|
|
|
it('labels dedicated sizes with a vCPU count', () => {
|
|
expect(getComputeCpuLabel('large', 2)).toBe('Dedicated · 2 vCPUs')
|
|
expect(getComputeCpuLabel('16xlarge', 64)).toBe('Dedicated · 64 vCPUs')
|
|
})
|
|
|
|
it('falls back to a generic dedicated label without a count', () => {
|
|
expect(getComputeCpuLabel('large')).toBe('Dedicated compute')
|
|
})
|
|
})
|