chore: finish replacing assert with expect in tests (#18215)

* spec: replace assert with expect in api-browser-view-spec.js

* spec: replace assert with expect in api-touch-bar-spec.js

* spec: replace assert with expect in api-web-frame-spec.js

* spec: replace assert with expect in api-web-contents-view-spec.js

* spec: replace assert with expect in security-warnings-spec.js

* spec: replace assert with expect in api-menu-item-spec.js

* spec: replace assert with expect in api-web-request-spec.js

* spec: replace assert with expect in api-remote-spec.js

* spec: replace assert with expect in api-session-spec.js

* spec: replace assert with expect in api-system-preferences-spec.js

* spec: replace assert with expect in api-browser-window-spec.js

* spec: replace assert with expect in webview-spec.js

* spec: replace assert with expect in api-net-spec.js

* spec: replace assert with expect in api-protocol-spec.js

* spec: replace assert with expect api-web-contents-spec.js

* spec: replace assert with expect in api-shell-spec.js

* spec: replace assert with expect in modules-spec.js

* spec: replace assert with expect in chromium-spec.js

* spec: replace assert with expect in api-crash-reporter-spec.js

* spec: replace assert with expect in asar-spec.js

* spec: rename assert-helpers to expect-helpers

* address PR feedback
This commit is contained in:
Milan Burda 2019-05-20 19:04:18 +02:00 committed by Charles Kerr
parent dbb8617214
commit 5a7b56b042
22 changed files with 1546 additions and 1591 deletions

View file

@ -6,7 +6,7 @@ const { BrowserWindow, app, Menu, MenuItem } = remote
const roles = require('../lib/browser/api/menu-item-roles')
const { closeWindow } = require('./window-helpers')
const { expect, assert } = chai
const { expect } = chai
chai.use(dirtyChai)
describe('MenuItems', () => {
@ -492,12 +492,9 @@ describe('MenuItems', () => {
{ label: 'text', accelerator: 'Alt+A' }
])
assert.strictEqual(menu.getAcceleratorTextAt(0),
isDarwin() ? '⌘A' : 'Ctrl+A')
assert.strictEqual(menu.getAcceleratorTextAt(1),
isDarwin() ? '⇧A' : 'Shift+A')
assert.strictEqual(menu.getAcceleratorTextAt(2),
isDarwin() ? '⌥A' : 'Alt+A')
expect(menu.getAcceleratorTextAt(0)).to.equal(isDarwin() ? '⌘A' : 'Ctrl+A')
expect(menu.getAcceleratorTextAt(1)).to.equal(isDarwin() ? '⇧A' : 'Shift+A')
expect(menu.getAcceleratorTextAt(2)).to.equal(isDarwin() ? '⌥A' : 'Alt+A')
})
it('should display modifiers correctly for special keys', () => {
@ -507,12 +504,9 @@ describe('MenuItems', () => {
{ label: 'text', accelerator: 'Alt+Tab' }
])
assert.strictEqual(menu.getAcceleratorTextAt(0),
isDarwin() ? '⌘⇥\u0000' : 'Ctrl+Tab')
assert.strictEqual(menu.getAcceleratorTextAt(1),
isDarwin() ? '⇧⇥\u0000' : 'Shift+Tab')
assert.strictEqual(menu.getAcceleratorTextAt(2),
isDarwin() ? '⌥⇥\u0000' : 'Alt+Tab')
expect(menu.getAcceleratorTextAt(0)).to.equal(isDarwin() ? '⌘⇥\u0000' : 'Ctrl+Tab')
expect(menu.getAcceleratorTextAt(1)).to.equal(isDarwin() ? '⇧⇥\u0000' : 'Shift+Tab')
expect(menu.getAcceleratorTextAt(2)).to.equal(isDarwin() ? '⌥⇥\u0000' : 'Alt+Tab')
})
it('should not display modifiers twice', () => {
@ -521,10 +515,8 @@ describe('MenuItems', () => {
{ label: 'text', accelerator: 'Shift+Shift+Tab' }
])
assert.strictEqual(menu.getAcceleratorTextAt(0),
isDarwin() ? '⇧A' : 'Shift+A')
assert.strictEqual(menu.getAcceleratorTextAt(1),
isDarwin() ? '⇧⇥\u0000' : 'Shift+Tab')
expect(menu.getAcceleratorTextAt(0)).to.equal(isDarwin() ? '⇧A' : 'Shift+A')
expect(menu.getAcceleratorTextAt(1)).to.equal(isDarwin() ? '⇧⇥\u0000' : 'Shift+Tab')
})
it('should display correctly for edge cases', () => {
@ -533,10 +525,8 @@ describe('MenuItems', () => {
{ label: 'text', accelerator: 'Control+Plus' }
])
assert.strictEqual(menu.getAcceleratorTextAt(0),
isDarwin() ? '⌃⇧=' : 'Ctrl+Shift+=')
assert.strictEqual(menu.getAcceleratorTextAt(1),
isDarwin() ? '⌃⇧=' : 'Ctrl+Shift+=')
expect(menu.getAcceleratorTextAt(0)).to.equal(isDarwin() ? '⌃⇧=' : 'Ctrl+Shift+=')
expect(menu.getAcceleratorTextAt(1)).to.equal(isDarwin() ? '⌃⇧=' : 'Ctrl+Shift+=')
})
})
})