mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-02 04:00:36 +00:00
Remove unnecessary global declarations
This commit is contained in:
parent
ed8a4ef651
commit
c444f54e42
1 changed files with 6 additions and 7 deletions
|
|
@ -18,10 +18,9 @@ global.expect = require("chai").expect
|
|||
# Nconf config
|
||||
##############################
|
||||
path = require("path")
|
||||
conf = require("nconf")
|
||||
global.conf = require("nconf")
|
||||
conf.argv().env().file(file: path.join(__dirname, "../config.json")).defaults()
|
||||
conf.set "PORT", "1337"
|
||||
global.conf = conf
|
||||
|
||||
##############################
|
||||
# Node ENV and global variables
|
||||
|
|
@ -34,8 +33,8 @@ global.user = undefined
|
|||
# Helper Methods
|
||||
##############################
|
||||
global.expectCode = (res, code) ->
|
||||
global.expect(res.body.err).to.not.exist if code is 200
|
||||
global.expect(res.statusCode).to.equal code
|
||||
expect(res.body.err).to.not.exist if code is 200
|
||||
expect(res.statusCode).to.equal code
|
||||
|
||||
global.registerNewUser = (cb, main) ->
|
||||
main = true unless main?
|
||||
|
|
@ -55,7 +54,7 @@ global.registerNewUser = (cb, main) ->
|
|||
return cb(null, res.body) unless main
|
||||
_id = res.body._id
|
||||
apiToken = res.body.apiToken
|
||||
global.User.findOne
|
||||
User.findOne
|
||||
_id: _id
|
||||
apiToken: apiToken
|
||||
, (err, _user) ->
|
||||
|
|
@ -68,8 +67,8 @@ global.registerNewUser = (cb, main) ->
|
|||
cb null, res.body
|
||||
|
||||
global.registerManyUsers = (number, callback) ->
|
||||
global.async.times number, (n, next) ->
|
||||
global.registerNewUser (err, user) ->
|
||||
async.times number, (n, next) ->
|
||||
registerNewUser (err, user) ->
|
||||
next(err, user)
|
||||
, false
|
||||
, (err, users) ->
|
||||
|
|
|
|||
Loading…
Reference in a new issue