mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
refactor: remove deprecated fixedLanguage
property from LanguageInfo
(#2111)
This commit is contained in:
parent
44772ba2e1
commit
01fdc4ba11
8 changed files with 1 additions and 19 deletions
|
@ -28,7 +28,6 @@ export const mockSignInExperience: SignInExperience = {
|
|||
languageInfo: {
|
||||
autoDetect: true,
|
||||
fallbackLanguage: 'en',
|
||||
fixedLanguage: 'zh-CN',
|
||||
},
|
||||
signInMethods: {
|
||||
username: SignInMethodState.Primary,
|
||||
|
@ -60,7 +59,6 @@ export const mockTermsOfUse: TermsOfUse = {
|
|||
export const mockLanguageInfo: LanguageInfo = {
|
||||
autoDetect: true,
|
||||
fallbackLanguage: 'en',
|
||||
fixedLanguage: 'zh-CN',
|
||||
};
|
||||
|
||||
export const mockSignInMethods: SignInMethods = {
|
||||
|
|
|
@ -78,7 +78,6 @@ describe('validate language info', () => {
|
|||
await validateLanguageInfo({
|
||||
autoDetect: true,
|
||||
fallbackLanguage: 'zh-CN',
|
||||
fixedLanguage: 'en',
|
||||
});
|
||||
expect(findAllCustomLanguageTags).toBeCalledTimes(1);
|
||||
});
|
||||
|
@ -89,7 +88,6 @@ describe('validate language info', () => {
|
|||
validateLanguageInfo({
|
||||
autoDetect: true,
|
||||
fallbackLanguage: builtInSupportedLanguage,
|
||||
fixedLanguage: 'en',
|
||||
})
|
||||
).resolves.not.toThrow();
|
||||
expect(findAllCustomLanguageTags).toBeCalledTimes(1);
|
||||
|
@ -103,7 +101,6 @@ describe('validate language info', () => {
|
|||
validateLanguageInfo({
|
||||
autoDetect: true,
|
||||
fallbackLanguage: customOnlySupportedLanguage,
|
||||
fixedLanguage: 'en',
|
||||
})
|
||||
).resolves.not.toThrow();
|
||||
expect(findAllCustomLanguageTags).toBeCalledTimes(1);
|
||||
|
@ -117,7 +114,6 @@ describe('validate language info', () => {
|
|||
validateLanguageInfo({
|
||||
autoDetect: true,
|
||||
fallbackLanguage: unsupportedLanguage,
|
||||
fixedLanguage: 'en',
|
||||
})
|
||||
).rejects.toMatchError(
|
||||
new RequestError({
|
||||
|
|
|
@ -57,7 +57,6 @@ const findDefaultSignInExperience = jest.fn(
|
|||
languageInfo: {
|
||||
autoDetect: true,
|
||||
fallbackLanguage: mockFallbackLanguage,
|
||||
fixedLanguage: mockFallbackLanguage,
|
||||
},
|
||||
})
|
||||
);
|
||||
|
|
|
@ -27,7 +27,6 @@ const findDefaultSignInExperience = jest.fn(async () => ({
|
|||
languageInfo: {
|
||||
autoDetect: true,
|
||||
fallbackLanguage,
|
||||
fixedLanguage: fallbackLanguage,
|
||||
},
|
||||
}));
|
||||
|
||||
|
@ -60,7 +59,6 @@ describe('when auto-detect is not enabled', () => {
|
|||
languageInfo: {
|
||||
autoDetect: false,
|
||||
fallbackLanguage: unsupportedLanguageX,
|
||||
fixedLanguage: unsupportedLanguageX,
|
||||
},
|
||||
});
|
||||
const response = await phraseRequest
|
||||
|
@ -76,7 +74,6 @@ describe('when auto-detect is not enabled', () => {
|
|||
languageInfo: {
|
||||
autoDetect: false,
|
||||
fallbackLanguage,
|
||||
fixedLanguage: fallbackLanguage,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -102,7 +99,6 @@ describe('when auto-detect is enabled', () => {
|
|||
languageInfo: {
|
||||
autoDetect: true,
|
||||
fallbackLanguage: unsupportedLanguageX,
|
||||
fixedLanguage: unsupportedLanguageX,
|
||||
},
|
||||
});
|
||||
const response = await phraseRequest
|
||||
|
@ -118,7 +114,6 @@ describe('when auto-detect is enabled', () => {
|
|||
languageInfo: {
|
||||
autoDetect: true,
|
||||
fallbackLanguage,
|
||||
fixedLanguage: fallbackLanguage,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
@ -29,7 +29,6 @@ const findDefaultSignInExperience = jest.fn(
|
|||
languageInfo: {
|
||||
autoDetect: true,
|
||||
fallbackLanguage: customizedLanguage,
|
||||
fixedLanguage: customizedLanguage,
|
||||
},
|
||||
})
|
||||
);
|
||||
|
@ -147,7 +146,6 @@ describe('when the application is not admin-console', () => {
|
|||
languageInfo: {
|
||||
autoDetect: false,
|
||||
fallbackLanguage: customizedLanguage,
|
||||
fixedLanguage: customizedLanguage,
|
||||
},
|
||||
});
|
||||
await expect(phraseRequest.get('/phrase')).resolves.toHaveProperty('status', 200);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { hexColorRegEx, languageKeys } from '@logto/core-kit';
|
||||
import { hexColorRegEx } from '@logto/core-kit';
|
||||
import { languageTagGuard } from '@logto/language-kit';
|
||||
import { z } from 'zod';
|
||||
|
||||
|
@ -124,8 +124,6 @@ export type TermsOfUse = z.infer<typeof termsOfUseGuard>;
|
|||
export const languageInfoGuard = z.object({
|
||||
autoDetect: z.boolean(),
|
||||
fallbackLanguage: languageTagGuard,
|
||||
/** @deprecated */
|
||||
fixedLanguage: z.enum(languageKeys),
|
||||
});
|
||||
|
||||
export type LanguageInfo = z.infer<typeof languageInfoGuard>;
|
||||
|
|
|
@ -20,7 +20,6 @@ export const defaultSignInExperience: Readonly<CreateSignInExperience> = {
|
|||
languageInfo: {
|
||||
autoDetect: true,
|
||||
fallbackLanguage: 'en',
|
||||
fixedLanguage: 'en',
|
||||
},
|
||||
termsOfUse: {
|
||||
enabled: false,
|
||||
|
|
|
@ -178,7 +178,6 @@ export const mockSignInExperience: SignInExperience = {
|
|||
languageInfo: {
|
||||
autoDetect: true,
|
||||
fallbackLanguage: 'en',
|
||||
fixedLanguage: 'zh-CN',
|
||||
},
|
||||
signInMethods: {
|
||||
username: SignInMethodState.Primary,
|
||||
|
|
Loading…
Reference in a new issue