-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from AnyFetch/new-api-cleaner-tests
Cleaner tests (reset is key)
- Loading branch information
Showing
9 changed files
with
683 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
var async = require('async'); | ||
var rarity = require('rarity'); | ||
|
||
module.exports = function makeResetFunction(anyfetchBasic) { | ||
/** | ||
* Reset the company and obtain the new Bearer token | ||
*/ | ||
return function(done) { | ||
var self = this; | ||
|
||
async.waterfall([ | ||
function resetCompany(cb) { | ||
anyfetchBasic.deleteCompanyReset(rarity.slice(1, cb)); | ||
}, | ||
function obtainNewToken(cb) { | ||
anyfetchBasic.getToken(cb); | ||
} | ||
], function(err, res) { | ||
if(err) { | ||
throw err; | ||
} | ||
self.token = res.body.token; | ||
done(); | ||
}); | ||
}; | ||
}; |
Oops, something went wrong.