mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-01 00:45:55 +00:00
Fix authHooks test suite
This commit is contained in:
parent
d4310bf970
commit
76e92fea22
@ -9,6 +9,9 @@ exports.failIfNotLoggedIn = (fn, onError) ->
|
||||
|
||||
if not isLoggedIn
|
||||
error = new Error(messages.errors.loginRequired)
|
||||
return onError?(error) or throw error
|
||||
if onError?
|
||||
return onError(error)
|
||||
else
|
||||
throw error
|
||||
|
||||
fn.apply(null, args)
|
||||
|
@ -4,6 +4,7 @@ sinon = require('sinon')
|
||||
expect = require('chai').expect
|
||||
config = require('../config')
|
||||
auth = require('../auth/auth')
|
||||
data = require('../data/data')
|
||||
authHooks = require('./auth')
|
||||
johnDoeFixture = require('../../tests/fixtures/johndoe')
|
||||
mock = require('../../tests/utils/mock')
|
||||
@ -18,6 +19,13 @@ describe 'Auth Hooks:', ->
|
||||
after ->
|
||||
mock.connection.restore()
|
||||
|
||||
beforeEach (done) ->
|
||||
mock.fs.init()
|
||||
data.prefix.set(config.dataPrefix, done)
|
||||
|
||||
afterEach ->
|
||||
mock.fs.restore()
|
||||
|
||||
describe 'if not logged in', ->
|
||||
|
||||
beforeEach (done) ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user