Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Dependencies are now managed via package.json instead of submodules; …

…fix test bugs.
  • Loading branch information...
commit d5da5b851df92f5f698f122704967d0231562368 1 parent a7dac43
Michael Mior authored Jordan Harband committed
View
1  .gitignore
@@ -0,0 +1 @@
+node_modules/
View
6 .gitmodules
@@ -1,6 +0,0 @@
-[submodule "deps/async"]
- path = deps/async
- url = git://github.com/caolan/async.git
-[submodule "deps/nodeunit"]
- path = deps/nodeunit
- url = git://github.com/caolan/nodeunit.git
1  deps/async
@@ -1 +0,0 @@
-Subproject commit 4351b56b951a193052df162f531d386b50ccdccc
1  deps/nodeunit
@@ -1 +0,0 @@
-Subproject commit 95b0e8ba044985ad3a98d13a4ba769afcbf1265c
View
10 package.json
@@ -11,13 +11,19 @@
"bugs": {
"url": "http://github.com/caolan/forms/issues"
},
+ "scripts": {
+ "test": "node test.js"
+ },
"dependencies": {
- "async": "0.1.22"
+ "async": "~0.1.22"
},
"licenses": [
{
"type": "MIT",
"url": "http://github.com/caolan/forms/raw/master/LICENSE"
}
- ]
+ ],
+ "devDependencies": {
+ "nodeunit": "~0.7.4"
+ }
}
View
22 test.js
@@ -1,22 +1,4 @@
#!/usr/local/bin/node
-// require.paths.push(__dirname);
-// require.paths.push(__dirname + '/deps');
-// require.paths.push(__dirname + '/lib');
-/* Note: require.paths is removed in node v0.5 and later. Use 'NODE_PATH=`pwd`:`pwd`/deps/:`pwd`/lib/ node test.js' to run tests. */
-
-try {
- var testrunner = require('nodeunit').testrunner;
-} catch(e) {
- var util = require('util');
- util.puts("Cannot find nodeunit module.");
- util.puts("You can download submodules for this project by doing:");
- util.puts("");
- util.puts(" git submodule init");
- util.puts(" git submodule update");
- util.puts("");
- process.exit();
-}
-
-process.chdir(__dirname);
-testrunner.run(['test']);
+var reporter = require('nodeunit').reporters.default;
+reporter.run(['test']);
View
35 test/test-validators.js
@@ -78,21 +78,26 @@ exports['email'] = function(test){
};
exports['url'] = function(test){
- validators.url()('form', {data: 'asdf.com'}, function(err){
- test.equals(err, 'Please enter a valid URL.');
- validators.url()('form', {data: 'http://asdf.com'}, function(err){
- test.equals(err, undefined);
- test.done();
- });
- });
-
- validators.url(true)('form', {data: 'localhost/test.html'}, function (err) {
- test.equals(err, 'Please enter a valid URL.');
- validators.url(true)('form', {data: 'http://localhost/test.html'}, function (err) {
- test.equals(err, undefined);
- test.done();
- });
- });
+ async.parallel([
+ function(callback){
+ validators.url()('form', {data: 'asdf.com'}, function(err){
+ test.equals(err, 'Please enter a valid URL.');
+ validators.url()('form', {data: 'http://asdf.com'}, function(err){
+ test.equals(err, undefined);
+ callback();
+ });
+ });
+ },
+ function(callback){
+ validators.url(true)('form', {data: 'localhost/test.html'}, function (err) {
+ test.equals(err, 'Please enter a valid URL.');
+ validators.url(true)('form', {data: 'http://localhost/test.html'}, function (err) {
+ test.equals(err, undefined);
+ test.done();
+ });
+ });
+ }
+ ], test.done);
};
exports['minlength'] = function(test){
Please sign in to comment.
Something went wrong with that request. Please try again.