0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-23 20:33:16 -05:00
logto/packages/integration-tests/tests/wellknown.test.ts
simeng-li c76a0b8430
test(test): add wellknown integration test (#1694)
add wellknown api integration test
2022-07-29 17:48:23 +08:00

40 lines
1.3 KiB
TypeScript

import { adminConsoleApplicationId } from '@logto/schemas/lib/seeds';
import { assert } from '@silverhand/essentials';
import { getWellKnownSignInExperience } from '@/api';
import MockClient from '@/client';
import { adminConsoleRedirectUri } from '@/constants';
describe('wellknown api', () => {
it('get /.well-known/sign-in-exp for AC', async () => {
const client = new MockClient({ appId: adminConsoleApplicationId });
await client.initSession(adminConsoleRedirectUri);
assert(client.interactionCookie, new Error('Session not found'));
const response = await getWellKnownSignInExperience(client.interactionCookie);
expect(response).toMatchObject({
signInMethods: {
username: 'primary',
email: 'disabled',
sms: 'disabled',
social: 'disabled',
},
signInMode: 'SignIn',
});
});
it('get /.well-known/sign-in-exp for general app', async () => {
const client = new MockClient();
await client.initSession();
assert(client.interactionCookie, new Error('Session not found'));
const response = await getWellKnownSignInExperience(client.interactionCookie);
// Should support sign-in and register
expect(response).toMatchObject({ signInMode: 'SignInAndRegister' });
});
});