mirror of
https://github.com/logto-io/logto.git
synced 2024-12-23 20:33:16 -05:00
41 lines
1.3 KiB
TypeScript
41 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' });
|
||
|
});
|
||
|
});
|