Permalink
Browse files

Add tests for init, setUp and tearDown timeout.

  • Loading branch information...
1 parent 20edeee commit f6c779046b5a4491f4141ac759927a1fb964cdab @Kami Kami committed Mar 30, 2011
Showing with 93 additions and 0 deletions.
  1. +19 −0 example/init-timeout.js
  2. +25 −0 example/test-setup-timeout.js
  3. +25 −0 example/test-teardown-timeout.js
  4. +24 −0 test/simple.sh
View
@@ -0,0 +1,19 @@
+/*
+ * Licensed to Cloudkick, Inc ('Cloudkick') under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * Cloudkick licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+exports['init'] = function(callback) {
+};
@@ -0,0 +1,25 @@
+/*
+ * Licensed to Cloudkick, Inc ('Cloudkick') under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * Cloudkick licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var assert = require('assert');
+
+exports['setUp'] = function(callback) {
+};
+
+exports['test_one_equals_two'] = function() {
+ assert.equal(1, 2);
+};
@@ -0,0 +1,25 @@
+/*
+ * Licensed to Cloudkick, Inc ('Cloudkick') under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * Cloudkick licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var assert = require('assert');
+
+exports['test_one_equals_two'] = function() {
+ assert.equal(1, 2);
+};
+
+exports['tearDown'] = function(callback) {
+};
View
@@ -29,6 +29,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
+# Test file does not exist
"${CWD}/bin/whiskey" --tests "${CWD}/example/test-inexistent.js"
if [ $? -ne 1 ]; then
@@ -115,4 +116,27 @@ if [ $? -ne 1 ]; then
exit 1
fi
+# Test init function timeout (init function is not called)
+"${CWD}/bin/whiskey" --timeout 2000 --test-init-file "${CWD}/example/init-timeout.js" --tests "${CWD}/example/test-failure.js" --chdir "${CWD}/example/"
+
+if [ $? -ne 1 ]; then
+ echo "Test should fail but passed."
+ exit 1
+fi
+
+# Test setUp function timeout (setUp function is not called)
+"${CWD}/bin/whiskey" --timeout 2000 --tests "${CWD}/example/test-setup-timeout.js" --chdir "${CWD}/example/"
+
+if [ $? -ne 1 ]; then
+ echo "Test should fail but passed."
+ exit 1
+fi
+
+# Test tearDown function timeout (tearDown function is not called)
+"${CWD}/bin/whiskey" --timeout 2000 --tests "${CWD}/example/test-teardown-timeout.js" --chdir "${CWD}/example/"
+
+if [ $? -ne 2 ]; then
+ echo "Test should fail but passed."
+ exit 1
+fi
exit 0

0 comments on commit f6c7790

Please sign in to comment.