// Load dependencies
var amanda = require('../src/amanda.js');

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

  /**
   * AddValidator
   */
  amanda.addValidator('unique', function(property, propertyValue, validator, propertyValidators, callback) {

    var takenUsernames = [
      'Baggz',
      'Amanda',
      'Administrator',
      'Admin'
    ];

    /**
     * {
     *   unique: true 
     * }
     */
    if (validator && takenUsernames.indexOf(propertyValue) !== -1) {
      return callback('Oops! This username - ' + propertyValue + ' - is taken.');
    } else {
      return callback(null);
    }

  });

  /**
   * Schema
   */
  var schema = {
    reqired: true,
    unique: true
  };

  [
    'Baggz',
    'Amanda',
    'Administrator',
    'Admin'
  ].forEach(function(input) {
    amanda.validate(input, schema, function(error) {
      test.ok(error);
    });
  });

  amanda.validate('Ryan', schema, function(error) {
    test.equal(error, undefined);
  });

  amanda.validate('Robb', schema, function(error) {
    test.equal(error, undefined);
  });

  test.done();

};
@@ -43,18 +43,19 @@
 '../
-src/amanda
+dist/latest
 .js'
@@ -169,22 +169,27 @@
 idator('
-unique
+myValidator
 ', funct
@@ -269,22 +269,17 @@
     var 
-takenU
+u
 sernames
@@ -363,65 +363,8 @@
 %5D;%0A%0A
-    /**%0A     * %7B%0A     *   unique: true %0A     * %7D%0A     */%0A
     
@@ -384,14 +384,9 @@
  && 
-takenU
+u
 sern
@@ -544,12 +544,8 @@
 ack(
-null
 );%0A 
@@ -625,14 +625,19 @@
     
-unique
+myValidator
 : tr
@@ -821,32 +821,1161 @@
 %0A    %7D);%0A  %7D);%0A%0A
+  %5B%0A    'Baggz',%0A    'Amanda',%0A    'Administrator',%0A    'Admin'%0A  %5D.forEach(function(input) %7B%0A    amanda.validate(input, schema, %7B singleError: true %7D, function(error) %7B%0A      test.ok(error);%0A    %7D);%0A  %7D);%0A%0A  %5B%0A    'Baggz',%0A    'Amanda',%0A    'Administrator',%0A    'Admin'%0A  %5D.forEach(function(input) %7B%0A    amanda.validate(input, schema, %7B singleError: false %7D, function(error) %7B%0A      console.log(arguments);%0A      test.ok(error);%0A    %7D);%0A  %7D);%0A%0A  %5B%0A    'Baggz',%0A    'Amanda',%0A    'Administrator',%0A    'Admin'%0A  %5D.forEach(function(input) %7B%0A%0A    amanda.validate(%0A      %7B%0A        name: input,%0A        username: 'Test'%0A      %7D, %0A      %7B%0A        type: 'object',%0A        properties: %7B%0A          name: %7B%0A            required: true,%0A            type: 'string',%0A            format: 'alphanumeric',%0A            myValidator: true%0A          %7D,%0A          username: %7B%0A            required: true,%0A            type: 'string',%0A            format: 'alphanumeric',%0A          %7D%0A        %7D%0A      %7D,%0A      %7B%0A        singleError: false%0A      %7D,%0A      function(error) %7B%0A        console.log(arguments);%0A        test.ok(error);%0A      %7D%0A    );%0A%0A  %7D);%0A%0A  /*%0A
   amanda.validat
@@ -2138,24 +2138,29 @@
 ined);%0A  %7D);
+%0A  */
 %0A%0A  test.don

Update the path to Amanda in the ‘addValidator.js’ file