Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amanda v0.0.2 #1

Merged
merged 3 commits into from Nov 24, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
881 changes: 595 additions & 286 deletions src/amanda.js

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions tests/addValidator.js
@@ -1,12 +1,15 @@
// Load dependencies // Load dependencies
var amanda = require('../src/amanda.js'); var amanda = require('../src/amanda.js');


exports['Test ‘addValidator’'] = function(test) { /**
* Test #1
*/
exports['Test #1'] = function(test) {


/** /**
* AddValidator * AddValidator
*/ */
amanda.addValidator('unique', function(paramName, paramValue, validator, validators, callback) { amanda.addValidator('unique', function(value, options, callback) {


var takenUsernames = [ var takenUsernames = [
'Baggz', 'Baggz',
Expand All @@ -20,8 +23,8 @@ exports['Test ‘addValidator’'] = function(test) {
* unique: true * unique: true
* } * }
*/ */
if (validator && takenUsernames.indexOf(paramValue) !== -1) { if (options && takenUsernames.indexOf(value) !== -1) {
return callback('Oops! This username - ' + paramValue + ' - is taken.'); return callback('Oops! This username - ' + value + ' - is taken.');
} else { } else {
return callback(null); return callback(null);
} }
Expand All @@ -32,6 +35,7 @@ exports['Test ‘addValidator’'] = function(test) {
* Schema * Schema
*/ */
var schema = { var schema = {
reqired: true,
unique: true unique: true
}; };


Expand Down
Empty file added tests/errorObject.js
Empty file.