Fix auth utils tests to work with new SDK

This commit is contained in:
Tim Perry 2018-03-28 17:48:20 +02:00
parent e965c603d2
commit d3a0bfc5f6
2 changed files with 9 additions and 3 deletions

View File

@ -78,6 +78,7 @@
"publish-release": "^1.3.3",
"require-npm4-to-publish": "^1.0.0",
"resin-lint": "^1.5.0",
"rewire": "^3.0.2",
"ts-node": "^4.0.1",
"typescript": "2.4.0"
},

View File

@ -1,10 +1,13 @@
m = require('mochainon')
url = require('url')
Promise = require('bluebird')
resin = require('resin-sdk-preconfigured')
utils = require('../../build/auth/utils')
tokens = require('./tokens.json')
rewire = require('rewire')
utils = rewire('../../build/auth/utils')
resin = utils.__get__('resin')
describe 'Utils:', ->
describe '.getDashboardLoginURL()', ->
@ -90,7 +93,9 @@ describe 'Utils:', ->
it 'should stay without a token', ->
utils.isTokenValid(tokens.johndoe.token).then ->
m.chai.expect(resin.token.get()).to.eventually.not.exist
resin.auth.isLoggedIn()
.then (isLoggedIn) ->
m.chai.expect(isLoggedIn).to.equal(false)
describe 'given the token does authenticate with the server', ->