mirror of
https://github.com/jellyfin/jellyfin-expo.git
synced 2024-11-22 21:49:46 +00:00
Update tests
This commit is contained in:
parent
edb7fc6087
commit
c4dcf099d9
@ -47,3 +47,11 @@ jest.mock('@react-navigation/native/lib/commonjs/useLinking.native', () => ({
|
||||
/* Safe Area Context Mocks */
|
||||
import mockSafeAreaContext from 'react-native-safe-area-context/jest/mock';
|
||||
jest.mock('react-native-safe-area-context', () => mockSafeAreaContext);
|
||||
|
||||
/* UUID Mocks */
|
||||
jest.mock('uuid', () => {
|
||||
let value = 0;
|
||||
return {
|
||||
v4: () => `uuid-${value++}`
|
||||
};
|
||||
});
|
||||
|
@ -26,6 +26,7 @@ describe('DownloadModel', () => {
|
||||
|
||||
expect(download.apiKey).toBe('api-key');
|
||||
expect(download.itemId).toBe('item-id');
|
||||
expect(download.sessionId).toBe('uuid-0');
|
||||
expect(download.serverId).toBe('server-id');
|
||||
expect(download.serverUrl).toBe('https://example.com/');
|
||||
|
||||
@ -42,6 +43,6 @@ describe('DownloadModel', () => {
|
||||
expect(download.localFilename).toBe('file name.mp4');
|
||||
expect(download.localPath).toBe(`${DOCUMENT_DIRECTORY}server-id/item-id/`);
|
||||
expect(download.uri).toBe(`${DOCUMENT_DIRECTORY}server-id/item-id/file%20name.mp4`);
|
||||
expect(download.getStreamUrl('device-id').toString()).toBe('https://example.com/Videos/item-id/stream.mp4?deviceId=device-id&api_key=api-key&videoCodec=hevc%2Ch264&audioCodec=aac%2Cmp3%2Cac3%2Ceac3%2Cflac%2Calac&maxAudioChannels=6');
|
||||
expect(download.getStreamUrl('device-id').toString()).toBe('https://example.com/Videos/item-id/stream.mp4?deviceId=device-id&api_key=api-key&playSessionId=uuid-0&videoCodec=hevc%2Ch264&audioCodec=aac%2Cmp3%2Cac3%2Ceac3%2Cflac%2Calac&maxAudioChannels=6');
|
||||
});
|
||||
});
|
||||
|
@ -33,6 +33,7 @@ exports[`DownloadScreen should render correctly 1`] = `
|
||||
"itemId": "item-id",
|
||||
"serverId": "server-id",
|
||||
"serverUrl": "https://example.com/",
|
||||
"sessionId": "uuid-0",
|
||||
"title": "title",
|
||||
},
|
||||
Object {
|
||||
@ -45,6 +46,7 @@ exports[`DownloadScreen should render correctly 1`] = `
|
||||
"itemId": "item-id-2",
|
||||
"serverId": "server-id",
|
||||
"serverUrl": "https://test2.example.com/",
|
||||
"sessionId": "uuid-1",
|
||||
"title": "other title",
|
||||
},
|
||||
]
|
||||
|
@ -3,6 +3,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
import { Jellyfin } from '@jellyfin/sdk';
|
||||
|
||||
import DownloadStore from '../DownloadStore';
|
||||
import MediaStore from '../MediaStore';
|
||||
import RootStore from '../RootStore';
|
||||
@ -17,6 +19,10 @@ describe('RootStore', () => {
|
||||
expect(store.isFullscreen).toBe(false);
|
||||
expect(store.isReloadRequired).toBe(false);
|
||||
expect(store.didPlayerCloseManually).toBe(true);
|
||||
|
||||
expect(store.sdk).toBeInstanceOf(Jellyfin);
|
||||
expect(store.sdk.deviceInfo.id).toBe(store.deviceId);
|
||||
|
||||
expect(store.downloadStore).toBeInstanceOf(DownloadStore);
|
||||
expect(store.mediaStore).toBeInstanceOf(MediaStore);
|
||||
expect(store.serverStore).toBeInstanceOf(ServerStore);
|
||||
|
Loading…
Reference in New Issue
Block a user