This repository has been archived by the owner on Jun 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test scope fixes, env.sh handler for no arg, test.sh to run tests
- Loading branch information
1 parent
390620e
commit 75f6b74
Showing
5 changed files
with
27 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
#!/bin/bash | ||
|
||
RED='\033[0;31m' | ||
YELLOW='\033[0;33m' | ||
NC='\033[0m' | ||
if [ -f config/$1.config ]; then | ||
while read line; do | ||
[[ "$line" =~ ^#.*$ ]] && continue | ||
[ -z "$line" ] && continue | ||
eval export "$line"; | ||
done < config/$1.config | ||
while read line; do | ||
[[ "$line" =~ ^#.*$ ]] && continue | ||
[ -z "$line" ] && continue | ||
eval export "$line"; | ||
done < config/$1.config | ||
else | ||
if [[ $1 == *"dev"* ]]; then | ||
echo -e "${RED}Missing a development configuration file\nPlease add a file called ${1}.config in the config directory\n${YELLOW}See the 'Configuration' section of the README for more information\n${NC}" | ||
elif [[ $1 == *"prod"* ]]; then | ||
echo -e "${RED}Missing a production configuration file\nPlease add a file called ${1}.config in the config directory\n${YELLOW}See the 'Configuration' section of the README for more information\n${NC}" | ||
elif [[ $1 == *"test"* ]]; then | ||
echo -e "${RED}Missing a test configuration file\nPlease add a file called ${1}.config in the config directory\n${YELLOW}See the 'Configuration' section of the README for more information\n${NC}" | ||
if [[ $1 == *"dev"* ]]; then | ||
echo -e "${RED}Missing a development configuration (dev.config)\n${NC}" | ||
elif [[ $1 == *"prod"* ]]; then | ||
echo -e "${RED}Missing a production configuration (prod.config)\n${NC}" | ||
elif [[ $1 == *"test"* ]]; then | ||
echo -e "${RED}Missing a test configuration (test.config)\n${NC}" | ||
else | ||
echo -e "${RED}Missing configuration parameter (specify 'prod', 'dev', or 'test')\n${NC}" | ||
fi | ||
exit 1 | ||
fi | ||
exit 1 | ||
fi |
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,4 @@ | ||
#!/bin/bash | ||
|
||
source resources/scripts/env.sh test | ||
mocha test/test.js --slow 500 --bail --check-leaks —full-trace |
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 |
---|---|---|
|
@@ -59,6 +59,7 @@ describe('AuthService',function(){ | |
}); | ||
|
||
describe('verify',function(){ | ||
var testUser; | ||
before(function(done){ | ||
testUser = User.forge({ id: 1, email: '[email protected]' }); | ||
testUser.related('roles').add({ role: utils.roles.ATTENDEE }); | ||
|
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 |
---|---|---|
|
@@ -19,6 +19,9 @@ var expect = chai.expect; | |
describe('TokenService',function(){ | ||
describe('findTokenByValue',function(){ | ||
var testToken; | ||
var _findByValue; | ||
var tokenVal; | ||
|
||
before(function(done){ | ||
tokenVal = utils.crypto.generateResetToken(); | ||
testToken = Token.forge({type: 'DEFAULT', value: tokenVal, user_id: 1}); | ||
|
@@ -74,7 +77,6 @@ describe('TokenService',function(){ | |
|
||
describe('generateToken',function(){ | ||
var testUser; | ||
var testToken; | ||
before(function(done){ | ||
|
||
var _mockedTokens = { | ||
|
@@ -89,12 +91,11 @@ describe('TokenService',function(){ | |
}; | ||
|
||
testUser = User.forge({ id: 1, email: '[email protected]' }); | ||
testToken = Token.forge({type: 'DEFAULT', value: tokenVal, user_id: 1}); | ||
|
||
_where = sinon.stub(Token,'where'); | ||
var _where = sinon.stub(Token,'where'); | ||
_where.returns(_mockedWhere); | ||
|
||
_save = sinon.stub(Token.prototype,'save'); | ||
var _save = sinon.stub(Token.prototype,'save'); | ||
_save.returns(_Promise.resolve(null)); | ||
done(); | ||
}); | ||
|