This commit is contained in:
Shelley Vohr 2019-04-25 15:44:54 -07:00 committed by GitHub
parent 6530c99cfa
commit 075b818a8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 38 deletions

View file

@ -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)
})
})
})