Fix getLoginItemSettings timing issue

This commit is contained in:
Ted Kim 2017-11-20 10:15:45 +09:00
parent d9481430df
commit 1660fc8d13

View file

@ -347,7 +347,7 @@ describe('app module', () => {
app.setLoginItemSettings({openAtLogin: false, path: updateExe, args: processStartArgs}) app.setLoginItemSettings({openAtLogin: false, path: updateExe, args: processStartArgs})
}) })
it('returns the login item status of the app', () => { it('returns the login item status of the app', (done) => {
app.setLoginItemSettings({openAtLogin: true}) app.setLoginItemSettings({openAtLogin: true})
assert.deepEqual(app.getLoginItemSettings(), { assert.deepEqual(app.getLoginItemSettings(), {
openAtLogin: true, openAtLogin: true,
@ -367,6 +367,9 @@ describe('app module', () => {
}) })
app.setLoginItemSettings({}) app.setLoginItemSettings({})
// Wait because login item settings are not applied immediately in MAS build
const delay = process.mas ? 100 : 0;
setTimeout(() => {
assert.deepEqual(app.getLoginItemSettings(), { assert.deepEqual(app.getLoginItemSettings(), {
openAtLogin: false, openAtLogin: false,
openAsHidden: false, openAsHidden: false,
@ -374,6 +377,8 @@ describe('app module', () => {
wasOpenedAsHidden: false, wasOpenedAsHidden: false,
restoreState: false restoreState: false
}) })
done()
}, delay);
}) })
it('allows you to pass a custom executable and arguments', () => { it('allows you to pass a custom executable and arguments', () => {