-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(menu): add basic tests with proxyquire
- Loading branch information
Showing
8 changed files
with
180 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Simple mock of electron's <app> module | ||
*/ | ||
const ElectronApp = { | ||
name: 'app' | ||
}; | ||
|
||
module.exports = ElectronApp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
|
||
|
||
/** | ||
* Simple mock of electron's <MenuItem> module | ||
*/ | ||
class ElectronMenuItem { | ||
constructor() {} | ||
} | ||
|
||
module.exports = ElectronMenuItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
|
||
/** | ||
* Simple mock of electron's <Menu> module | ||
*/ | ||
class ElectronMenu { | ||
static buildFromTemplate() {} | ||
|
||
static setApplicationMenu() {} | ||
|
||
constructor() {} | ||
|
||
append() {} | ||
} | ||
|
||
module.exports = ElectronMenu; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use strict'; | ||
|
||
const proxyquire = require('proxyquire'); | ||
|
||
const ElectronApp = require('../../helper/mock/electron-app'); | ||
const ElectronMenu = require('../../helper/mock/electron-menu'); | ||
const ElectronMenuItem = require('../../helper/mock/electron-menu-item'); | ||
|
||
const Electron = { | ||
app: ElectronApp, | ||
Menu: ElectronMenu, | ||
MenuItem: ElectronMenuItem | ||
}; | ||
|
||
const MenuBuilder = proxyquire('../../../lib/menu/menu-builder.js', { | ||
electron: Electron | ||
}); | ||
|
||
|
||
describe('MenuBuilder', () => { | ||
|
||
it('should instantiate', () => { | ||
const menuBuilder = new MenuBuilder(); | ||
|
||
expect(menuBuilder).to.exist; | ||
}); | ||
|
||
|
||
it('should build menu', () => { | ||
const menuBuilder = new MenuBuilder(); | ||
|
||
const menu = menuBuilder.build(); | ||
|
||
expect(menu).to.exist; | ||
}); | ||
|
||
}); |
Oops, something went wrong.