SnowLuma v2.4.2 source snapshot
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
Publish MCP to npm / Build, test, and publish MCP (push) Waiting to run
Publish SDK to npm / Build, test, and publish SDK (push) Waiting to run
Sync action catalog to docs / sync (push) Waiting to run
Publish UI to npm / Build and publish UI (push) Waiting to run
Build and Release / preflight (push) Waiting to run
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
Publish MCP to npm / Build, test, and publish MCP (push) Waiting to run
Publish SDK to npm / Build, test, and publish SDK (push) Waiting to run
Sync action catalog to docs / sync (push) Waiting to run
Publish UI to npm / Build and publish UI (push) Waiting to run
Build and Release / preflight (push) Waiting to run
This commit is contained in:
commit
fa9c73363d
1367 files changed
+355735
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import type { ApiActionContext } from '../src/api-handler';
|
||||
import { actions } from '../src/actions/group-file';
|
||||
|
||||
describe('get_group_file_url storage selection', () => {
|
||||
it.each([
|
||||
{ busid: undefined, expected: undefined },
|
||||
{ busid: null, expected: undefined },
|
||||
{ busid: '', expected: undefined },
|
||||
{ busid: 'invalid', expected: undefined },
|
||||
{ busid: -1, expected: undefined },
|
||||
{ busid: 102, expected: 102 },
|
||||
{ busid: '104', expected: 104 },
|
||||
{ busid: 0, expected: 0 },
|
||||
])(
|
||||
'passes an explicit valid type, otherwise lets the file cache select it (%j)',
|
||||
async ({ busid, expected }) => {
|
||||
const getUrl = vi.fn(async () => 'https://download.example.com/file');
|
||||
const ctx = {
|
||||
bridge: { apis: { groupFile: { getUrl } } },
|
||||
} as unknown as ApiActionContext;
|
||||
const action = actions.find((entry) => entry.names[0] === 'get_group_file_url')!;
|
||||
const result = await action.toHandler(ctx)({ group_id: 12345, file_id: 'temp', busid });
|
||||
expect(result).toMatchObject({ status: 'ok' });
|
||||
expect(getUrl).toHaveBeenCalledExactlyOnceWith(12345, 'temp', expected);
|
||||
},
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user