biome format --write
This commit is contained in:
parent
8372348148
commit
9262e803ec
415 changed files with 54076 additions and 17419 deletions
42
test/fixtures/mock_api.js
vendored
42
test/fixtures/mock_api.js
vendored
|
|
@ -17,8 +17,8 @@ export const injectMswToTest = (defaultHandlers) => {
|
|||
worker.stop()
|
||||
},
|
||||
{
|
||||
auto: true
|
||||
}
|
||||
auto: true,
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
|
|
@ -29,34 +29,44 @@ export const authApis = [
|
|||
http.post(`${testServer}/api/v1/apps`, () => {
|
||||
return HttpResponse.json({
|
||||
client_id: 'test-id',
|
||||
client_secret: 'test-secret'
|
||||
client_secret: 'test-secret',
|
||||
})
|
||||
}),
|
||||
http.get(`${testServer}/api/v1/apps/verify_credentials`, ({ request }) => {
|
||||
const authHeader = request.headers.get('Authorization')
|
||||
if (authHeader === 'Bearer test-app-token' ||
|
||||
authHeader === 'Bearer also-good-app-token') {
|
||||
if (
|
||||
authHeader === 'Bearer test-app-token' ||
|
||||
authHeader === 'Bearer also-good-app-token'
|
||||
) {
|
||||
return HttpResponse.json({})
|
||||
} else {
|
||||
// Pleroma 2.9.0 gives the following respoonse upon error
|
||||
return HttpResponse.json({ error: { detail: 'Internal server error' } }, {
|
||||
status: 400
|
||||
})
|
||||
return HttpResponse.json(
|
||||
{ error: { detail: 'Internal server error' } },
|
||||
{
|
||||
status: 400,
|
||||
},
|
||||
)
|
||||
}
|
||||
}),
|
||||
http.post(`${testServer}/oauth/token`, async ({ request }) => {
|
||||
const data = await request.formData()
|
||||
|
||||
if (data.get('client_id') === 'test-id' &&
|
||||
data.get('client_secret') === 'test-secret' &&
|
||||
data.get('grant_type') === 'client_credentials' &&
|
||||
data.has('redirect_uri')) {
|
||||
if (
|
||||
data.get('client_id') === 'test-id' &&
|
||||
data.get('client_secret') === 'test-secret' &&
|
||||
data.get('grant_type') === 'client_credentials' &&
|
||||
data.has('redirect_uri')
|
||||
) {
|
||||
return HttpResponse.json({ access_token: 'test-app-token' })
|
||||
} else {
|
||||
// Pleroma 2.9.0 gives the following respoonse upon error
|
||||
return HttpResponse.json({ error: 'Invalid credentials' }, {
|
||||
status: 400
|
||||
})
|
||||
return HttpResponse.json(
|
||||
{ error: 'Invalid credentials' },
|
||||
{
|
||||
status: 400,
|
||||
},
|
||||
)
|
||||
}
|
||||
})
|
||||
}),
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue