-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Description
Hi!
I've been testing this library but cannot seem to figure out how to set up each test to work in a Supabase-like environment. When setting up my tests like demonstrated below, I don't seem to get any of the Supabase related things configured (for example auth schema, storage tables and types, etc.)
How my tests are set up:
import { getConnections, type PgTestClient } from "supabase-test"
import {
afterAll,
afterEach,
beforeAll,
beforeEach,
describe,
expect,
it,
} from "vitest"
import { getSupabaseMigrationFiles } from "../utils/supabase"
let db: PgTestClient
let pg: PgTestClient
let teardown: () => Promise<void>
beforeAll(async () => {
const connections = await getConnections()
db = connections.db
pg = connections.pg
teardown = connections.teardown
// Load my own Supabase migration files
// that are dependent on Supabase-related objects being present
const migrationFiles = getSupabaseMigrationFiles()
await pg.loadSql(migrationFiles)
})
beforeEach(async () => {
if (db) {
await db.beforeEach()
}
})
afterEach(async () => {
if (db) {
await db.afterEach()
}
})
afterAll(async () => {
if (teardown) {
await teardown()
}
})Is this library supposed to set up each test database to emulate a Supabase environment or am I missing something here? Do I need to create each of the Supabase dependencies myself for each test? Any clearification is appreciated!
Thanks!
Metadata
Metadata
Assignees
Labels
No labels