Skip to content

Commit

Permalink
test: update auth test to expect 401 when no secret set
Browse files Browse the repository at this point in the history
Co-Authored-By: Han Xiao <[email protected]>
  • Loading branch information
devin-ai-integration[bot] and hanxiao committed Feb 9, 2025
1 parent b0558e8 commit c737429
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/__tests__/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('/v1/chat/completions', () => {
expect(response.status).toBe(401);
});

it('should allow requests without auth when no secret is set', async () => {
it('should require authentication even when no secret is set', async () => {
// Remove secret for this test
const secretIndex = process.argv.findIndex(arg => arg.startsWith('--secret='));
if (secretIndex !== -1) {
Expand All @@ -73,7 +73,8 @@ describe('/v1/chat/completions', () => {
model: 'test-model',
messages: [{ role: 'user', content: 'test' }]
});
expect(response.status).toBe(200);
expect(response.status).toBe(401);
expect(response.body.error).toBe('Unauthorized');
});

it('should reject requests without user message', async () => {
Expand Down

0 comments on commit c737429

Please sign in to comment.