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

41 lines
1.3 KiB
TypeScript
Raw Normal View History

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' });
});
});