mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-10-20 17:01:24 -07:00
fix(jellyfin): make terminal play work with a running app and report progress (#288)
This commit is contained in:
1 parent
78eca52b7e
commit
78a9b6346f
33 files changed
+934
-924
No files matched your search
@@ -66,6 +66,7 @@ test('run jellyfin command returns after auth branch handles command', async ()
|
||||
calls.push('list');
|
||||
return false;
|
||||
},
|
||||
writeJellyfinResponse: () => {},
|
||||
handlePlayCommand: async () => {
|
||||
calls.push('play');
|
||||
return false;
|
||||
@@ -76,7 +77,8 @@ test('run jellyfin command returns after auth branch handles command', async ()
|
||||
assert.deepEqual(calls, ['auth']);
|
||||
});
|
||||
|
||||
test('run jellyfin command throws when session missing after auth', async () => {
|
||||
test('run jellyfin command throws when session missing and writes the error reply', async () => {
|
||||
const writes: Array<{ path: string; response: unknown }> = [];
|
||||
const run = createRunJellyfinCommandHandler({
|
||||
getJellyfinConfig: () => ({ serverUrl: '', accessToken: '', userId: '' }),
|
||||
defaultServerUrl: '',
|
||||
@@ -84,10 +86,20 @@ test('run jellyfin command throws when session missing after auth', async () =>
|
||||
handleAuthCommands: async () => false,
|
||||
handleRemoteAnnounceCommand: async () => false,
|
||||
handleListCommands: async () => false,
|
||||
writeJellyfinResponse: (path, response) => writes.push({ path, response }),
|
||||
handlePlayCommand: async () => false,
|
||||
});
|
||||
|
||||
await assert.rejects(() => run(createArgs()), /Missing Jellyfin session/);
|
||||
await assert.rejects(
|
||||
() => run(createArgs({ jellyfinResponsePath: '/tmp/reply.json' })),
|
||||
/Missing Jellyfin session/,
|
||||
);
|
||||
assert.deepEqual(writes, [
|
||||
{
|
||||
path: '/tmp/reply.json',
|
||||
response: { error: 'Missing Jellyfin session. Run --jellyfin-login first.' },
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
test('run jellyfin command dispatches remote/list/play in order until handled', async () => {
|
||||
@@ -116,6 +128,7 @@ test('run jellyfin command dispatches remote/list/play in order until handled',
|
||||
seenServerUrls.push(session.serverUrl);
|
||||
return true;
|
||||
},
|
||||
writeJellyfinResponse: () => {},
|
||||
handlePlayCommand: async () => {
|
||||
calls.push('play');
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user