Skip to content

Commit

Permalink
Don't run non launchAgent tests on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
4ver committed Dec 11, 2023
1 parent 6ec7ca7 commit b4c6e17
Showing 1 changed file with 56 additions and 54 deletions.
110 changes: 56 additions & 54 deletions tests/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,75 +29,77 @@ describe 'node-auto-launch', ->
path: executablePath
autoLaunchHelper = new AutoLaunchHelper(autoLaunch)

if not isMac
describe '.isEnabled', ->
beforeEach ->
autoLaunchHelper.ensureDisabled()

describe '.isEnabled', ->
beforeEach ->
autoLaunchHelper.ensureDisabled()

it 'should be disabled', (done) ->
autoLaunch.isEnabled().then (enabled) ->
expect(enabled).to.equal false
done()
.catch done
return
it 'should be disabled', (done) ->
autoLaunch.isEnabled().then (enabled) ->
expect(enabled).to.equal false
done()
.catch done
return

it 'should catch errors', (done) ->
autoLaunchHelper.mockApi
isEnabled: ->
Promise.reject()
it 'should catch errors', (done) ->
autoLaunchHelper.mockApi
isEnabled: ->
Promise.reject()

autoLaunch.isEnabled().catch done
return
autoLaunch.isEnabled().catch done
return


describe '.enable', ->
beforeEach ->
autoLaunchHelper.ensureDisabled()
describe '.enable', ->
beforeEach ->
autoLaunchHelper.ensureDisabled()

it 'should enable auto launch', (done) ->
autoLaunch.enable()
.then -> autoLaunch.isEnabled()
.then (enabled) ->
expect(enabled).to.equal true
done()
.catch done
return
it 'should enable auto launch', (done) ->
autoLaunch.enable()
.then (xxx) ->
console.log 'fefew', xxx
autoLaunch.isEnabled()
.then (enabled) ->
expect(enabled).to.equal true
done()
.catch done
return

it 'should catch errors', (done) ->
autoLaunchHelper.mockApi
enable: -> Promise.reject()
it 'should catch errors', (done) ->
autoLaunchHelper.mockApi
enable: -> Promise.reject()

autoLaunch.enable().catch done
return
autoLaunch.enable().catch done
return


describe '.disable', ->
beforeEach ->
autoLaunchHelper.ensureEnabled()
describe '.disable', ->
beforeEach ->
autoLaunchHelper.ensureEnabled()

it 'should disable auto launch', (done) ->
autoLaunch.disable()
.then -> autoLaunch.isEnabled()
.then (enabled) ->
expect(enabled).to.equal false
done()
.catch done
return
it 'should disable auto launch', (done) ->
autoLaunch.disable()
.then -> autoLaunch.isEnabled()
.then (enabled) ->
expect(enabled).to.equal false
done()
.catch done
return

it 'should catch errors', (done) ->
autoLaunchHelper.mockApi
disable: ->
Promise.reject()
it 'should catch errors', (done) ->
autoLaunchHelper.mockApi
disable: ->
Promise.reject()

autoLaunch.disable().catch done
return
autoLaunch.disable().catch done
return


if isLinux
it 'should use name option', (done) ->
expect(autoLaunch.opts.appName).to.equal 'node-auto-launch test'
done()
return
if isLinux
it 'should use name option', (done) ->
expect(autoLaunch.opts.appName).to.equal 'node-auto-launch test'
done()
return


# Let's test some Mac-only options
Expand Down

0 comments on commit b4c6e17

Please sign in to comment.