Files
supabase/apps/studio/tests/components/ProjectDropdown.test.ts
Ivan Vasilov cb1e3a8170 chore: Prep work for pnpm (#29610)
* 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.
2024-10-01 11:29:37 +02:00

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'
)
})