High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
chore(web): use development lang for tests (#10025)
Michel Heusschend5f3d98dfc36
diff --git a/web/src/lib/components/album-page/__tests__/album-card.spec.ts b/web/src/lib/components/album-page/__tests__/album-card.spec.tsindex 6ffa273a4d..977899db82 100644--- a/web/src/lib/components/album-page/__tests__/album-card.spec.ts+++ b/web/src/lib/components/album-page/__tests__/album-card.spec.ts@@ -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);diff --git a/web/src/lib/components/album-page/album-description.spec.ts b/web/src/lib/components/album-page/album-description.spec.tsindex 61bfb70596..1c069de2bc 100644--- a/web/src/lib/components/album-page/album-description.spec.ts+++ b/web/src/lib/components/album-page/album-description.spec.ts@@ -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');diff --git a/web/src/lib/components/shared-components/notification/__tests__/notification-card.spec.ts b/web/src/lib/components/shared-components/notification/__tests__/notification-card.spec.tsindex 25d648fca4..76b9c39564 100644--- a/web/src/lib/components/shared-components/notification/__tests__/notification-card.spec.ts+++ b/web/src/lib/components/shared-components/notification/__tests__/notification-card.spec.ts@@ -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');diff --git a/web/src/lib/components/shared-components/notification/__tests__/notification-list.spec.ts b/web/src/lib/components/shared-components/notification/__tests__/notification-list.spec.tsindex c84a6d4582..44634d6b20 100644--- a/web/src/lib/components/shared-components/notification/__tests__/notification-list.spec.ts+++ b/web/src/lib/components/shared-components/notification/__tests__/notification-list.spec.ts@@ -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>): HTMLAdescribe('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-runningvi.stubGlobal('requestAnimationFrame', (fn: FrameRequestCallback) => {setTimeout(() => fn(Date.now()), 16);diff --git a/web/src/lib/i18n.spec.ts b/web/src/lib/i18n.spec.tsindex 6bfcc32b43..43f3a689e9 100644--- a/web/src/lib/i18n.spec.ts+++ b/web/src/lib/i18n.spec.ts@@ -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);diff --git a/web/src/test-data/setup.ts b/web/src/test-data/setup.tsindex 7b0828bfa8..6709bd5b80 100644--- a/web/src/test-data/setup.ts+++ b/web/src/test-data/setup.ts@@ -1 +1,6 @@import '@testing-library/jest-dom';+import { init } from 'svelte-i18n';++beforeAll(async () => {+ await init({ fallbackLocale: 'dev' });+});