Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add unit tests
  • Loading branch information
ddollar committed Mar 23, 2012
1 parent 598fc57 commit 5b75769
Show file tree
Hide file tree
Showing 6 changed files with 1,316 additions and 0 deletions.
51 changes: 51 additions & 0 deletions bin/test
@@ -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 added test/no-package-json/Gemfile
Empty file.
4 changes: 4 additions & 0 deletions test/package-json-noversion/package.json
@@ -0,0 +1,4 @@
{
"name": "myapp",
"version": "0.0.1"
}
9 changes: 9 additions & 0 deletions test/package-json-version/package.json
@@ -0,0 +1,9 @@
{
"name": "myapp",
"version": "0.0.1",

"engines": {
"node": "0.6.11",
"npm": "1.1.9"
}
}

0 comments on commit 5b75769

Please sign in to comment.