mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-31 02:39:03 -04:00 
			
		
		
		
	chore(web): use development lang for tests (#10025)
This commit is contained in:
		
							parent
							
								
									3e118793de
								
							
						
					
					
						commit
						d5f3d98dfc
					
				| @ -2,7 +2,6 @@ import { sdkMock } from '$lib/__mocks__/sdk.mock'; | ||||
| import { albumFactory } from '@test-data'; | ||||
| import '@testing-library/jest-dom'; | ||||
| import { fireEvent, render, waitFor, type RenderResult } from '@testing-library/svelte'; | ||||
| import { init, register, waitLocale } from 'svelte-i18n'; | ||||
| import AlbumCard from '../album-card.svelte'; | ||||
| 
 | ||||
| const onShowContextMenu = vi.fn(); | ||||
| @ -10,12 +9,6 @@ const onShowContextMenu = vi.fn(); | ||||
| describe('AlbumCard component', () => { | ||||
|   let sut: RenderResult<AlbumCard>; | ||||
| 
 | ||||
|   beforeAll(async () => { | ||||
|     await init({ fallbackLocale: 'en-US' }); | ||||
|     register('en-US', () => import('$lib/i18n/en.json')); | ||||
|     await waitLocale('en-US'); | ||||
|   }); | ||||
| 
 | ||||
|   it.each([ | ||||
|     { | ||||
|       album: albumFactory.build({ albumThumbnailAssetId: null, shared: false, assetCount: 0 }), | ||||
| @ -43,7 +36,7 @@ describe('AlbumCard component', () => { | ||||
|     const albumImgElement = sut.getByTestId('album-image'); | ||||
|     const albumNameElement = sut.getByTestId('album-name'); | ||||
|     const albumDetailsElement = sut.getByTestId('album-details'); | ||||
|     const detailsText = `${count} items` + (shared ? ' . Shared' : ''); | ||||
|     const detailsText = `${count} items` + (shared ? ' . shared' : ''); | ||||
| 
 | ||||
|     expect(albumImgElement).toHaveAttribute('src'); | ||||
|     expect(albumImgElement).toHaveAttribute('alt', album.albumName); | ||||
|  | ||||
| @ -1,14 +1,9 @@ | ||||
| import AlbumDescription from '$lib/components/album-page/album-description.svelte'; | ||||
| import '@testing-library/jest-dom'; | ||||
| import { render, screen } from '@testing-library/svelte'; | ||||
| import { init } from 'svelte-i18n'; | ||||
| import { describe } from 'vitest'; | ||||
| 
 | ||||
| describe('AlbumDescription component', () => { | ||||
|   beforeAll(async () => { | ||||
|     await init({ fallbackLocale: 'en-US' }); | ||||
|   }); | ||||
| 
 | ||||
|   it('shows an AutogrowTextarea component when isOwned is true', () => { | ||||
|     render(AlbumDescription, { isOwned: true, id: '', description: '' }); | ||||
|     const autogrowTextarea = screen.getByTestId('autogrow-textarea'); | ||||
|  | ||||
| @ -1,16 +1,11 @@ | ||||
| import '@testing-library/jest-dom'; | ||||
| import { cleanup, render, type RenderResult } from '@testing-library/svelte'; | ||||
| import { init } from 'svelte-i18n'; | ||||
| import { NotificationType } from '../notification'; | ||||
| import NotificationCard from '../notification-card.svelte'; | ||||
| 
 | ||||
| describe('NotificationCard component', () => { | ||||
|   let sut: RenderResult<NotificationCard>; | ||||
| 
 | ||||
|   beforeAll(async () => { | ||||
|     await init({ fallbackLocale: 'en-US' }); | ||||
|   }); | ||||
| 
 | ||||
|   it('disposes timeout if already removed from the DOM', () => { | ||||
|     vi.spyOn(window, 'clearTimeout'); | ||||
| 
 | ||||
|  | ||||
| @ -1,6 +1,5 @@ | ||||
| import '@testing-library/jest-dom'; | ||||
| import { render, waitFor, type RenderResult } from '@testing-library/svelte'; | ||||
| import { init } from 'svelte-i18n'; | ||||
| import { get } from 'svelte/store'; | ||||
| import { NotificationType, notificationController } from '../notification'; | ||||
| import NotificationList from '../notification-list.svelte'; | ||||
| @ -12,8 +11,7 @@ function _getNotificationListElement(sut: RenderResult<NotificationList>): HTMLA | ||||
| describe('NotificationList component', () => { | ||||
|   const sut: RenderResult<NotificationList> = render(NotificationList); | ||||
| 
 | ||||
|   beforeAll(async () => { | ||||
|     await init({ fallbackLocale: 'en-US' }); | ||||
|   beforeAll(() => { | ||||
|     // https://testing-library.com/docs/svelte-testing-library/faq#why-arent-transition-events-running
 | ||||
|     vi.stubGlobal('requestAnimationFrame', (fn: FrameRequestCallback) => { | ||||
|       setTimeout(() => fn(Date.now()), 16); | ||||
|  | ||||
| @ -1,7 +1,6 @@ | ||||
| import messages from '$lib/i18n/en.json'; | ||||
| import { exec as execCallback } from 'node:child_process'; | ||||
| import { promisify } from 'node:util'; | ||||
| import { init } from 'svelte-i18n'; | ||||
| 
 | ||||
| type Messages = { [key: string]: string | Messages }; | ||||
| 
 | ||||
| @ -23,8 +22,6 @@ function setEmptyMessages(messages: Messages) { | ||||
| } | ||||
| 
 | ||||
| describe('i18n', () => { | ||||
|   beforeEach(() => init({ fallbackLocale: 'dev' })); | ||||
| 
 | ||||
|   test('no missing messages', async () => { | ||||
|     const { stdout } = await exec('npx svelte-i18n extract -c svelte.config.js "src/**/*"'); | ||||
|     const extractedMessages: Messages = JSON.parse(stdout); | ||||
|  | ||||
| @ -1 +1,6 @@ | ||||
| import '@testing-library/jest-dom'; | ||||
| import { init } from 'svelte-i18n'; | ||||
| 
 | ||||
| beforeAll(async () => { | ||||
|   await init({ fallbackLocale: 'dev' }); | ||||
| }); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user