-
-
Notifications
You must be signed in to change notification settings - Fork 424
Expand file tree
/
Copy pathcli-server.spec.ts
More file actions
32 lines (25 loc) · 1001 Bytes
/
cli-server.spec.ts
File metadata and controls
32 lines (25 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { describe, expect, it } from 'vitest'
import { createConnectorApp } from '../../cli/src/server.ts'
const TEST_TOKEN = 'test-token-123'
describe('connector server', () => {
describe('GET /team/:scopeTeam/users', () => {
it('returns 400 for invalid scope:team format (missing @ prefix)', async () => {
const app = createConnectorApp(TEST_TOKEN)
const response = await app.fetch(
new Request('http://localhost/team/netlify%3Adevelopers/users', {
headers: { Authorization: `Bearer ${TEST_TOKEN}` },
}),
)
expect(response.status).toBe(400)
const body = await response.json()
expect(body.message).toContain('Invalid scope:team format')
})
it('returns 401 without auth token', async () => {
const app = createConnectorApp(TEST_TOKEN)
const response = await app.fetch(
new Request('http://localhost/team/@netlify%3Adevelopers/users'),
)
expect(response.status).toBe(401)
})
})
})