[MM-47801][MM-45980] Added support for security-scoped bookmarks to allow the MAS build to save files wherever needed (#2315)

* First pass

* [MM-47801] Added support for security-scoped bookmarks to allow the MAS build to save files wherever needed
This commit is contained in:
Devin Binnie
2022-10-25 08:02:00 -04:00
committed by GitHub
parent 0f51a628f0
commit 635a41f998
11 changed files with 139 additions and 34 deletions

View File

@@ -117,6 +117,7 @@ const item = {
getStartTime: () => nowSeconds,
getTotalBytes: () => 4242,
getSavePath: () => locationMock,
getURL: () => 'http://some-url.com/some-text.txt',
hasUserGesture: jest.fn().mockReturnValue(true),
setSavePath: jest.fn(),
on: jest.fn(),
@@ -144,7 +145,8 @@ describe('main/downloadsManager', () => {
it('should handle a new download', () => {
const dl = new DownloadsManager({});
path.parse.mockImplementation(() => ({base: 'file.txt'}));
dl.handleNewDownload({}, item, {id: 0, getURL: jest.fn()});
dl.willDownloadURLs.set('http://some-url.com/some-text.txt', {filePath: locationMock});
dl.handleNewDownload({preventDefault: jest.fn()}, item, {id: 0, getURL: jest.fn(), downloadURL: jest.fn()});
expect(dl).toHaveProperty('downloads', {'file.txt': {
addedAt: nowSeconds * 1000,
filename: 'file.txt',