mirror of
https://github.com/jely2002/youtube-dl-gui.git
synced 2021-11-01 22:46:21 +03:00
feat: show progress while updating/installing dependencies
This commit is contained in:
@@ -136,7 +136,7 @@ describe("downloadUpdate", () => {
|
||||
const mockReadable = new PassThrough();
|
||||
const mockWriteable = new PassThrough();
|
||||
jest.spyOn(fs, 'createWriteStream').mockReturnValueOnce(mockWriteable);
|
||||
jest.spyOn(axios, 'get').mockResolvedValue({ data: mockReadable });
|
||||
jest.spyOn(axios, 'get').mockResolvedValue({ data: mockReadable, headers: { "content-length": 1200 } });
|
||||
setTimeout(() => {
|
||||
mockWriteable.emit('error', "Test error");
|
||||
}, 100);
|
||||
@@ -150,7 +150,7 @@ describe("downloadUpdate", () => {
|
||||
const mockReadable = new PassThrough();
|
||||
const mockWriteable = new PassThrough();
|
||||
jest.spyOn(fs, 'createWriteStream').mockReturnValueOnce(mockWriteable);
|
||||
jest.spyOn(axios, 'get').mockResolvedValue({ data: mockReadable });
|
||||
jest.spyOn(axios, 'get').mockResolvedValue({ data: mockReadable, headers: { "content-length": 1200 } });
|
||||
setTimeout(() => {
|
||||
mockWriteable.emit('close');
|
||||
}, 100);
|
||||
|
||||
@@ -106,7 +106,7 @@ describe('checkUpdate', () => {
|
||||
jest.spyOn(instance, 'getRemoteVersion').mockResolvedValue(["link", "v2.0.0"]);
|
||||
return instance.checkUpdate().then(() => {
|
||||
expect(downloadUpdateSpy).toBeCalledTimes(2);
|
||||
expect(instance.win.webContents.send).toBeCalledTimes(1);
|
||||
expect(instance.win.webContents.send).toBeCalledTimes(2);
|
||||
});
|
||||
});
|
||||
it('downloads the latest remote version when local version is different', () => {
|
||||
@@ -117,7 +117,7 @@ describe('checkUpdate', () => {
|
||||
jest.spyOn(instance, 'getRemoteVersion').mockResolvedValue({ remoteUrl: "link", remoteVersion: "2021.10.10" });
|
||||
return instance.checkUpdate().then(() => {
|
||||
expect(downloadUpdateSpy).toBeCalledTimes(2);
|
||||
expect(instance.win.webContents.send).toBeCalledTimes(1);
|
||||
expect(instance.win.webContents.send).toBeCalledTimes(2);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user