0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

refactor: fix test

This commit is contained in:
Gao Sun 2023-03-30 13:59:02 +08:00
parent 5c50957a95
commit ae0185cab0
No known key found for this signature in database
GPG key ID: 13EBE123E4773688
3 changed files with 8 additions and 8 deletions

View file

@ -6,7 +6,7 @@ import { mockId } from '#src/test-utils/nanoid.js';
export const enTag = 'en';
export const trTrTag = 'tr-TR';
export const zhCnTag = 'zh-CN';
export const zhHkTag = 'zh-HK';
export const mockTag = 'fo-BA';
export const mockEnCustomPhrase = {
tenantId: 'fake_tenant',
@ -66,7 +66,7 @@ export const mockZhCnCustomPhrase = {
export const mockZhHkCustomPhrase = {
tenantId: 'fake_tenant',
id: mockId,
languageTag: zhHkTag,
languageTag: mockTag,
translation: {
input: {
email: '郵箱 1',

View file

@ -9,7 +9,7 @@ import {
mockZhHkCustomPhrase,
trTrTag,
zhCnTag,
zhHkTag,
mockTag,
} from '#src/__mocks__/custom-phrase.js';
import { wellKnownCache } from '#src/caches/well-known.js';
import RequestError from '#src/errors/RequestError/index.js';
@ -19,7 +19,7 @@ const { jest } = import.meta;
const englishBuiltInPhrase = resource[enTag];
const customOnlyLanguage = zhHkTag;
const customOnlyLanguage = mockTag;
const customOnlyCustomPhrase = mockZhHkCustomPhrase;
const customizedLanguage = zhCnTag;

View file

@ -2,7 +2,7 @@ import en from '@logto/phrases-ui/lib/locales/en/index.js';
import type { SignInExperience } from '@logto/schemas';
import { pickDefault } from '@logto/shared/esm';
import { trTrTag, zhCnTag, zhHkTag } from '#src/__mocks__/custom-phrase.js';
import { trTrTag, zhCnTag, mockTag } from '#src/__mocks__/custom-phrase.js';
import { mockSignInExperience } from '#src/__mocks__/index.js';
import { wellKnownCache } from '#src/caches/well-known.js';
import { MockTenant } from '#src/test-utils/tenant.js';
@ -58,7 +58,7 @@ describe('when auto-detect is not enabled', () => {
});
const response = await phraseRequest
.get('/.well-known/phrases')
.set('Accept-Language', `${zhCnTag},${zhHkTag}`);
.set('Accept-Language', `${zhCnTag},${mockTag}`);
expect(response.headers['content-language']).toEqual('en');
});
@ -81,7 +81,7 @@ describe('when auto-detect is not enabled', () => {
it('when there are detected languages', async () => {
const response = await phraseRequest
.get('/.well-known/phrases')
.set('Accept-Language', `${zhCnTag},${zhHkTag}`);
.set('Accept-Language', `${zhCnTag},${mockTag}`);
expect(response.headers['content-language']).toEqual(fallbackLanguage);
});
});
@ -135,7 +135,7 @@ describe('when auto-detect is enabled', () => {
const firstSupportedLanguage = zhCnTag;
const response = await phraseRequest
.get('/.well-known/phrases')
.set('Accept-Language', `${unsupportedLanguageX},${firstSupportedLanguage},${zhHkTag}`);
.set('Accept-Language', `${unsupportedLanguageX},${firstSupportedLanguage},${mockTag}`);
expect(response.headers['content-language']).toEqual(firstSupportedLanguage);
});
});