Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldietzler committed Nov 11, 2024
1 parent 4d5aaf6 commit 3bdbf04
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
22 changes: 22 additions & 0 deletions web/src/lib/components/asset-viewer/photo-viewer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,28 @@ describe('PhotoViewer component', () => {
beforeAll(() => {
getAssetOriginalUrlSpy = vi.spyOn(utils, 'getAssetOriginalUrl');
getAssetThumbnailUrlSpy = vi.spyOn(utils, 'getAssetThumbnailUrl');
vi.stubGlobal('cast', {
framework: {
CastState: {
NO_DEVICES_AVAILABLE: 'NO_DEVICES_AVAILABLE',
},
RemotePlayer: vi.fn().mockImplementation(() => ({})),
RemotePlayerEventType: {
ANY_CHANGE: 'anyChanged',
},
RemotePlayerController: vi.fn().mockImplementation(() => ({ addEventListener: vi.fn() })),
CastContext: {
getInstance: vi.fn().mockImplementation(() => ({ setOptions: vi.fn(), addEventListener: vi.fn() })),
},
CastContextEventType: {
SESSION_STATE_CHANGED: 'sessionstatechanged',
CAST_STATE_CHANGED: 'caststatechanged',
},
},
});
vi.stubGlobal('chrome', {
cast: { media: { PlayerState: { IDLE: 'IDLE' } }, AutoJoinPolicy: { ORIGIN_SCOPED: 'origin_scoped' } },
});
});

beforeEach(() => {
Expand Down
1 change: 1 addition & 0 deletions web/src/lib/components/cast/cast-button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import CastPlayer, { loadCastFramework } from '$lib/utils/cast-player';
import Button from '$lib/components/elements/buttons/button.svelte';
import { onMount } from 'svelte';
onMount(async () => {
await loadCastFramework();
CastPlayer.getInstance();
Expand Down
1 change: 1 addition & 0 deletions web/svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const config = {
'$lib/*': 'src/lib/*',
'@test-data': 'src/test-data',
$i18n: '../i18n',
'chromecast-caf-sender': './node_modules/@types/chromecast-caf-sender/index.d.ts',
},
},
};
Expand Down
3 changes: 0 additions & 3 deletions web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"forceConsistentCasingInFileNames": true,
"module": "es2020",
"moduleResolution": "bundler",
"paths": {
"chromecast-caf-sender": ["./node_modules/@types/chromecast-caf-sender/index.d.ts"]
},
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
Expand Down
3 changes: 0 additions & 3 deletions web/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { svelteTesting } from '@testing-library/svelte/vite';
import path from 'node:path';
import { visualizer } from 'rollup-plugin-visualizer';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';

const upstream = {
target: process.env.IMMICH_SERVER_URL || 'http://immich-server:2283/',
Expand All @@ -20,7 +19,6 @@ export default defineConfig({
'xmlhttprequest-ssl': './node_modules/engine.io-client/lib/xmlhttprequest.js',
// eslint-disable-next-line unicorn/prefer-module
'@test-data': path.resolve(__dirname, './src/test-data'),
'chromecast-caf-sender': path.resolve(__dirname, 'node_modules/@types/chromecast-caf-sender/index.d.ts'),
},
},
server: {
Expand All @@ -41,7 +39,6 @@ export default defineConfig({
: undefined,
enhancedImages(),
svelteTesting(),
tsconfigPaths(),
],
optimizeDeps: {
entries: ['src/**/*.{svelte,ts,html}'],
Expand Down

0 comments on commit 3bdbf04

Please sign in to comment.