Skip to content

Commit

Permalink
test: fix failing test because of new event parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
brenca committed Nov 6, 2018
1 parent ae042aa commit 652afe6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 3 additions & 2 deletions spec/api-session-spec.js
Expand Up @@ -425,6 +425,7 @@ describe('session module', () => {

it('can set options for the save dialog', (done) => {
downloadServer.listen(0, '127.0.0.1', () => {
const filePath = path.join(__dirname, 'fixtures', 'mock.pdf')
const port = downloadServer.address().port
const options = {
window: null,
Expand All @@ -442,7 +443,7 @@ describe('session module', () => {
securityScopedBookmarks: true
}

ipcRenderer.sendSync('set-download-option', true, false, undefined, options)
ipcRenderer.sendSync('set-download-option', true, false, filePath, options)
w.webContents.downloadURL(`${url}:${port}`)
ipcRenderer.once('download-done', (event, state, url,
mimeType, receivedBytes,
Expand Down Expand Up @@ -730,7 +731,7 @@ describe('session module', () => {
const downloadUrl = `http://127.0.0.1:${port}/assets/logo.png`
const callback = (event, state, url, mimeType,
receivedBytes, totalBytes, disposition,
filename, savePath, urlChain,
filename, savePath, dialogOptions, urlChain,
lastModifiedTime, eTag) => {
if (state === 'cancelled') {
const options = {
Expand Down
4 changes: 0 additions & 4 deletions spec/static/main.js
Expand Up @@ -162,10 +162,6 @@ app.on('ready', function () {
// reply the result to renderer for verifying
const downloadFilePath = path.join(__dirname, '..', 'fixtures', 'mock.pdf')
ipcMain.on('set-download-option', function (event, needCancel, preventDefault, filePath = downloadFilePath, dialogOptions = {}) {
// Set default when undefined was given on the other side of the IPC channel
if (filePath === null) {
filePath = downloadFilePath
}
window.webContents.session.once('will-download', function (e, item) {
window.webContents.send('download-created',
item.getState(),
Expand Down

0 comments on commit 652afe6

Please sign in to comment.