forked from heroku/heroku-buildpack-nodejs
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
add unit tests
- Loading branch information
Showing
6 changed files
with
1,316 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# Create a Heroku app with the following buildpack: | ||
# https://github.com/ddollar/buildpack-test | ||
# | ||
# Push this buildpack to the Heroku app to run the tests | ||
# | ||
|
||
testDetectWithPackageJson() { | ||
detect package-json-version | ||
assertCaptured "Node.js" | ||
assertCapturedSuccess | ||
} | ||
|
||
testDetectWithoutPackageJson() { | ||
detect no-package-json | ||
assertCapturedError 1 "" | ||
} | ||
|
||
testPackageJsonWithVersion() { | ||
compile package-json-version | ||
assertCaptured "Using Node.js version: 0.6.11" | ||
assertCaptured "Using npm version: 1.1.9" | ||
assertCapturedSuccess | ||
} | ||
|
||
testPackageJsonWithNoVersion() { | ||
compile package-json-noversion | ||
assertCaptured "Using Node.js version: 0.4.7" | ||
assertCaptured "Using npm version: 1.0.106" | ||
assertCapturedSuccess | ||
} | ||
|
||
## utils ######################################## | ||
|
||
pushd $(dirname 0) >/dev/null | ||
BASE=$(pwd) | ||
popd >/dev/null | ||
|
||
source ${BASE}/vendor/test-utils/test-utils | ||
|
||
detect() { | ||
capture ${BASE}/bin/detect ${BASE}/test/$1 | ||
} | ||
|
||
compile() { | ||
capture ${BASE}/bin/compile ${BASE}/test/$1 | ||
} | ||
|
||
source ${BASE}/vendor/shunit2/shunit2 |
Empty file.
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 @@ | ||
{ | ||
"name": "myapp", | ||
"version": "0.0.1" | ||
} |
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,9 @@ | ||
{ | ||
"name": "myapp", | ||
"version": "0.0.1", | ||
|
||
"engines": { | ||
"node": "0.6.11", | ||
"npm": "1.1.9" | ||
} | ||
} |
Oops, something went wrong.