fixes (#17363)
This commit is contained in:
parent
6530c99cfa
commit
075b818a8e
5 changed files with 35 additions and 38 deletions
|
@ -502,51 +502,31 @@ describe('app module', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('app.setBadgeCount', () => {
|
||||
describe('app.badgeCount', () => {
|
||||
const platformIsNotSupported =
|
||||
(process.platform === 'win32') ||
|
||||
(process.platform === 'linux' && !app.isUnityRunning())
|
||||
const platformIsSupported = !platformIsNotSupported
|
||||
|
||||
const expectedBadgeCount = 42
|
||||
let returnValue: boolean | null = null
|
||||
|
||||
beforeEach(() => { returnValue = app.setBadgeCount(expectedBadgeCount) })
|
||||
|
||||
after(() => {
|
||||
// Remove the badge.
|
||||
app.setBadgeCount(0)
|
||||
})
|
||||
after(() => { app.badgeCount = 0 })
|
||||
|
||||
describe('on supported platform', () => {
|
||||
before(function () {
|
||||
if (platformIsNotSupported) {
|
||||
this.skip()
|
||||
}
|
||||
})
|
||||
it('sets a badge count', function () {
|
||||
if (platformIsNotSupported) return this.skip()
|
||||
|
||||
it('returns true', () => {
|
||||
expect(returnValue).to.equal(true)
|
||||
})
|
||||
|
||||
it('sets a badge count', () => {
|
||||
expect(app.getBadgeCount()).to.equal(expectedBadgeCount)
|
||||
app.badgeCount = expectedBadgeCount
|
||||
expect(app.badgeCount).to.equal(expectedBadgeCount)
|
||||
})
|
||||
})
|
||||
|
||||
describe('on unsupported platform', () => {
|
||||
before(function () {
|
||||
if (platformIsSupported) {
|
||||
this.skip()
|
||||
}
|
||||
})
|
||||
it('does not set a badge count', function () {
|
||||
if (platformIsSupported) return this.skip()
|
||||
|
||||
it('returns false', () => {
|
||||
expect(returnValue).to.equal(false)
|
||||
})
|
||||
|
||||
it('does not set a badge count', () => {
|
||||
expect(app.getBadgeCount()).to.equal(0)
|
||||
app.badgeCount = 9999
|
||||
expect(app.badgeCount).to.equal(0)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue