55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
/**
|
|
* E2E tests for Messaging API
|
|
*
|
|
* Tests the REST API endpoints for threads, messages, and clips.
|
|
*/
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
const API_URL = process.env.API_URL || 'http://localhost:3010';
|
|
|
|
test.describe('Messaging API', () => {
|
|
test.describe('Health Check', () => {
|
|
test('should return healthy status', async ({ request }) => {
|
|
const response = await request.get(`${API_URL}/health`);
|
|
expect(response.ok()).toBeTruthy();
|
|
|
|
const body = await response.json();
|
|
expect(body.status).toBe('ok');
|
|
});
|
|
});
|
|
|
|
test.describe('Threads API', () => {
|
|
test('should require authentication for thread creation', async ({ request }) => {
|
|
const response = await request.post(`${API_URL}/api/threads`, {
|
|
data: {
|
|
clientId: 'client-123',
|
|
clientType: 'registered',
|
|
},
|
|
});
|
|
|
|
// Should return 401 without auth
|
|
expect(response.status()).toBe(401);
|
|
});
|
|
});
|
|
|
|
test.describe('Clips API', () => {
|
|
test('should require authentication for clip creation', async ({ request }) => {
|
|
const response = await request.post(`${API_URL}/api/clips`, {
|
|
data: {
|
|
threadId: 'thread-123',
|
|
clipType: 'full',
|
|
},
|
|
});
|
|
|
|
// Should return 401 without auth
|
|
expect(response.status()).toBe(401);
|
|
});
|
|
|
|
test('should require authentication for listing clips', async ({ request }) => {
|
|
const response = await request.get(`${API_URL}/api/clips/mine`);
|
|
|
|
// Should return 401 without auth
|
|
expect(response.status()).toBe(401);
|
|
});
|
|
});
|
|
});
|