Files
supabase/packages/pg-meta/test/sql/studio/lints.test.ts
T
Joshen Lim 98b1b79909 Chore/shift manual queries into pg meta 04 (#43956)
## Context

Shifts all remaining dashboard queries into pg-meta so that we
centralize all manually written queries in one place
Having them in packages/pg-meta also allows us to write tests for them

## To test

Just needs a smoke test on
- Role Impersonation
- Lints
- Data API
- Database
  - Enumerated Types
- Integrations
  - Foreign Data Wrappers
  - Vault
2026-03-24 16:23:13 +08:00

28 lines
976 B
TypeScript

import { describe, expect, it } from 'vitest'
import { enrichLintsQuery } from '../../../src'
describe('enrichLintsQuery', () => {
const dummyQuery = 'SELECT 1'
it('should include SET LOCAL pgrst.db_schemas when exposedSchemas is provided', () => {
const result = enrichLintsQuery(dummyQuery, 'public, storage')
expect(result).toContain("set local pgrst.db_schemas = 'public, storage';")
})
it('should NOT include SET LOCAL pgrst.db_schemas when exposedSchemas is undefined', () => {
const result = enrichLintsQuery(dummyQuery, undefined)
expect(result).not.toContain('pgrst.db_schemas')
})
it('should NOT include SET LOCAL pgrst.db_schemas when exposedSchemas is empty string', () => {
const result = enrichLintsQuery(dummyQuery, '')
expect(result).not.toContain('pgrst.db_schemas')
})
it('should always include the query', () => {
const result = enrichLintsQuery(dummyQuery)
expect(result).toContain(dummyQuery)
})
})