mirror of
https://github.com/supabase/supabase.git
synced 2026-09-06 18:11:51 +08:00
## New Features - Initial work for showing configuration drift in Studio - This only works for Github-connected projects and it'll show a banner if the project state differs from the git-tracked `config.toml` - Currently behind a feature-flag `ConfigDrift`, enabled on local and staging. - There might be drift shown without changing any setting, this is work-in-progress. <img width="1217" height="1195" alt="Screenshot 2026-08-19 at 23 12 10" src="https://github.com/user-attachments/assets/fb0b18d8-1a93-4595-85cc-e8b8a3462847" /> ## How to test 1. Connect a project to a Github repo 2. Resync the branch on `/dashboard/project/_/branches`. This will trigger deployment of the `config.toml` on your project 3. Change some settings (I recommend `dashboard/project/_/auth/providers` 4. A banner should appear on all project pages with a link ## Tests - Added coverage for configuration conversion, normalization, matching, drift detection, and unmanaged settings. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { getGitBranchName } from './useGitHubConfigDrift'
|
|
import type { Branch } from '@/data/branches/branches-query'
|
|
|
|
function branch(overrides: Partial<Branch>): Branch {
|
|
return {
|
|
created_at: '2024-01-01T00:00:00Z',
|
|
updated_at: '2024-01-01T00:00:00Z',
|
|
id: 'branch-id',
|
|
is_default: false,
|
|
name: 'feature/foo',
|
|
parent_project_ref: 'parent-ref',
|
|
persistent: false,
|
|
project_ref: 'project-ref',
|
|
status: 'MIGRATIONS_PASSED',
|
|
with_data: false,
|
|
...overrides,
|
|
}
|
|
}
|
|
|
|
describe('getGitBranchName', () => {
|
|
it('returns undefined when there is no branch', () => {
|
|
expect(getGitBranchName(undefined)).toBeUndefined()
|
|
})
|
|
|
|
it('prefers the trimmed git_branch when set', () => {
|
|
expect(getGitBranchName(branch({ git_branch: ' main ', name: 'feature/foo' }))).toBe('main')
|
|
})
|
|
|
|
it('falls back to the trimmed branch name when git_branch is unset', () => {
|
|
expect(getGitBranchName(branch({ git_branch: undefined, name: ' feature/foo ' }))).toBe(
|
|
'feature/foo'
|
|
)
|
|
})
|
|
|
|
it('falls back to the branch name when git_branch is blank', () => {
|
|
expect(getGitBranchName(branch({ git_branch: ' ', name: 'feature/foo' }))).toBe('feature/foo')
|
|
})
|
|
|
|
it('returns undefined for the default branch when git_branch is unset', () => {
|
|
expect(getGitBranchName(branch({ git_branch: undefined, is_default: true }))).toBeUndefined()
|
|
})
|
|
|
|
it('still prefers git_branch for the default branch when it is set', () => {
|
|
expect(getGitBranchName(branch({ git_branch: 'main', is_default: true }))).toBe('main')
|
|
})
|
|
})
|