mirror of
https://github.com/supabase/supabase.git
synced 2026-07-04 13:34:28 +08:00
* Add all missing libraries in the packages/apps. * Add all missing Vitest imports to the tests. * Add some missing exports to ui. * Fix the admonition export. * Fix various minor bugs. * Migrate the ui package to use vitest.
21 lines
955 B
TypeScript
21 lines
955 B
TypeScript
import { sanitizeRoute } from 'components/layouts/AppLayout/ProjectDropdown'
|
|
import { test, expect } from 'vitest'
|
|
|
|
test('Should sanitize project routes correctly when switching projects by removing project specific parameters', () => {
|
|
expect(sanitizeRoute('/project/[ref]', { ref: 'abc' })).toBe('/project/[ref]')
|
|
expect(sanitizeRoute('/project/[ref]/editor', { ref: 'abc' })).toBe('/project/[ref]/editor')
|
|
expect(sanitizeRoute('/project/[ref]/storage/buckets', { ref: 'abc' })).toBe(
|
|
'/project/[ref]/storage/buckets'
|
|
)
|
|
|
|
expect(sanitizeRoute('/project/[ref]/editor/[tableId]', { ref: 'abc', tableId: '10' })).toBe(
|
|
'/project/[ref]/editor'
|
|
)
|
|
expect(
|
|
sanitizeRoute('/project/[ref]/storage/buckets/[bucketId]', { ref: 'abc', bucketId: 'bucket-1' })
|
|
).toBe('/project/[ref]/storage/buckets')
|
|
expect(sanitizeRoute('/project/[ref]/logs/explorer?q=select', { ref: 'abc' })).toBe(
|
|
'/project/[ref]/logs/explorer?q=select'
|
|
)
|
|
})
|