0
Fork 0
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:
Xiao Yijun 2022-10-11 20:25:35 +08:00 committed by GitHub
parent 44772ba2e1
commit 01fdc4ba11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 1 additions and 19 deletions

View file

@ -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 = {

View file

@ -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({

View file

@ -57,7 +57,6 @@ const findDefaultSignInExperience = jest.fn(
languageInfo: {
autoDetect: true,
fallbackLanguage: mockFallbackLanguage,
fixedLanguage: mockFallbackLanguage,
},
})
);

View file

@ -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,
},
});
});

View file

@ -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);

View file

@ -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>;

View file

@ -20,7 +20,6 @@ export const defaultSignInExperience: Readonly<CreateSignInExperience> = {
languageInfo: {
autoDetect: true,
fallbackLanguage: 'en',
fixedLanguage: 'en',
},
termsOfUse: {
enabled: false,

View file

@ -178,7 +178,6 @@ export const mockSignInExperience: SignInExperience = {
languageInfo: {
autoDetect: true,
fallbackLanguage: 'en',
fixedLanguage: 'zh-CN',
},
signInMethods: {
username: SignInMethodState.Primary,