0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-20 21:32:31 -05:00

refactor(core): fix test

This commit is contained in:
Gao Sun 2023-03-17 15:24:52 +08:00
parent e0fad2dccd
commit 680b555c70
No known key found for this signature in database
GPG key ID: 13EBE123E4773688
2 changed files with 10 additions and 5 deletions

View file

@ -1,9 +1,6 @@
import type { SignInExperience, CreateSignInExperience } from '@logto/schemas'; import type { SignInExperience, CreateSignInExperience } from '@logto/schemas';
import { pickDefault, createMockUtils } from '@logto/shared/esm'; import { pickDefault, createMockUtils } from '@logto/shared/esm';
import { MockTenant } from '#src/test-utils/tenant.js';
import { createRequester } from '#src/utils/test-utils.js';
import { import {
mockFacebookConnector, mockFacebookConnector,
mockGithubConnector, mockGithubConnector,
@ -20,6 +17,8 @@ import {
mockPrivacyPolicyUrl, mockPrivacyPolicyUrl,
mockDemoSocialConnector, mockDemoSocialConnector,
} from '#src/__mocks__/index.js'; } from '#src/__mocks__/index.js';
import { MockTenant } from '#src/test-utils/tenant.js';
import { createRequester } from '#src/utils/test-utils.js';
const { jest } = import.meta; const { jest } = import.meta;
const { mockEsmWithActual } = createMockUtils(jest); const { mockEsmWithActual } = createMockUtils(jest);
@ -57,8 +56,12 @@ const mockDeleteConnectorById = jest.fn();
const tenantContext = new MockTenant( const tenantContext = new MockTenant(
undefined, undefined,
{ signInExperiences, customPhrases: { findAllCustomLanguageTags: async () => [] } }, {
{ getLogtoConnectors: async () => logtoConnectors }, signInExperiences,
customPhrases: { findAllCustomLanguageTags: async () => [] },
connectors: { deleteConnectorById: mockDeleteConnectorById },
},
{ getLogtoConnectors: mockGetLogtoConnectors },
{ signInExperiences: { validateLanguageInfo } } { signInExperiences: { validateLanguageInfo } }
); );

View file

@ -62,6 +62,8 @@ export default function signInExperiencesRoutes<T extends AuthedRouter>(
) )
); );
console.log('???', socialSignInConnectorTargets, filteredSocialSignInConnectorTargets);
if (signUp) { if (signUp) {
validateSignUp(signUp, connectors); validateSignUp(signUp, connectors);
} }