committed by
GitHub
parent
b4c8c74bd0
commit
cada76070f
18
apps/e2e/tests/healthcheck.spec.ts
Normal file
18
apps/e2e/tests/healthcheck.spec.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
// Simple healthcheck test to verify the API is up and the database responds
|
||||
|
||||
test.describe('Healthcheck endpoint', () => {
|
||||
test('returns healthy status', async ({ request }) => {
|
||||
const response = await request.get('/healthcheck');
|
||||
|
||||
expect(response.status()).toBe(200);
|
||||
|
||||
const body = await response.json();
|
||||
expect(body).toEqual(
|
||||
expect.objectContaining({
|
||||
services: expect.objectContaining({ database: true }),
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -26,11 +26,12 @@ async function getSupabaseHealthCheck() {
|
||||
try {
|
||||
const client = getSupabaseServerAdminClient();
|
||||
|
||||
const { error } = await client.rpc('is_set', {
|
||||
field_name: 'billing_provider',
|
||||
});
|
||||
const { data, error } = await client
|
||||
.from('config')
|
||||
.select('billing_provider')
|
||||
.single();
|
||||
|
||||
return !error;
|
||||
return !error && Boolean(data?.billing_provider);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user