mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
20 lines
543 B
TypeScript
20 lines
543 B
TypeScript
import { expect, test } from 'vitest'
|
|
|
|
import { API_URL } from '@/lib/constants'
|
|
|
|
test('MSW works as expected', async () => {
|
|
const res = await fetch(`${API_URL}/msw/test`)
|
|
const json = await res.json()
|
|
|
|
expect(res.status).toBe(200)
|
|
expect(json).toEqual({ message: 'Hello from MSW!' })
|
|
})
|
|
|
|
test('MSW errors on missing endpoints', async () => {
|
|
expect(async () => {
|
|
const res = await fetch(`${API_URL}/endpoint-that-doesnt-exist`)
|
|
const json = await res.json()
|
|
expect(json).toEqual({ message: '🚫 MSW missed' })
|
|
})
|
|
})
|