Permalink
Browse files

Remove the obsolete ‘ArraysSingleError’ test suite

  • Loading branch information...
1 parent 3fad3cb commit 05c4582dd289f562b2f5ddd8d698df1ab73ea80a @Baggz committed Mar 7, 2012
Showing with 0 additions and 308 deletions.
  1. +0 −308 tests/validation/arraysSingleError.js
@@ -1,308 +0,0 @@
-// Load dependencies
-var amanda = require('../../dist/latest.js');
-
-// Error methods
-var errorMethods = [
- 'getProperties',
- 'getMessages'
-];
-
-/**
- * Test #1
- */
-exports['Test #1'] = function(test) {
-
- var a = 0;
-
- var schema = {
- type: 'array'
- };
-
- [
- 'Hello',
- 123,
- true,
- {},
- function() {}
- ].forEach(function(input) {
-
- amanda.validate(input, schema, function(error) {
-
- a += 1;
-
- delete error[0].message;
-
- test.deepEqual(error[0], {
- property: '',
- propertyValue: input,
- validator: 'type',
- validatorValue: 'array'
- });
-
- test.equal(error.length, 1);
-
- errorMethods.forEach(function(method) {
- test.ok(error[method]);
- });
-
- });
-
- });
-
- test.equal(a, 5);
- test.done();
-
-};
-
-/**
- * Test #2
- */
-exports['Test #2'] = function(test) {
-
- var a = 0;
-
- var schema = {
- type: 'array',
- items: {
- type: 'string'
- }
- };
-
- amanda.validate([
- 'abc',
- 'def',
- 123,
- 'jkl',
- 'mno',
- 456
- ], schema, function(error) {
-
- a += 1;
-
- delete error[0].message;
-
- test.deepEqual(error[0], {
- property: '[2]',
- propertyValue: 123,
- validator: 'type',
- validatorValue: 'string'
- });
-
- test.equal(error.length, 1);
-
- errorMethods.forEach(function(method) {
- test.ok(error[method]);
- });
-
- });
-
- test.equal(a, 1);
- test.done();
-
-};
-
-/**
- * Test #3
- */
-exports['Test #3'] = function(test) {
-
- var a = 0;
-
- var schema = {
- type: 'array',
- items: {
- type: 'array'
- }
- };
-
- [
- 'Hello',
- 123,
- true,
- {},
- function() {}
- ].forEach(function(input) {
-
- amanda.validate(input, schema, function(error) {
-
- a += 1;
-
- delete error[0].message;
-
- test.deepEqual(error[0], {
- property: '',
- propertyValue: input,
- validator: 'type',
- validatorValue: 'array'
- });
-
- test.equal(error.length, 1);
-
- errorMethods.forEach(function(method) {
- test.ok(error[method]);
- });
-
- });
-
- });
-
- amanda.validate([], schema, function(error) {
-
- a += 1;
-
- test.equal(error, undefined)
-
- });
-
- [
- 'Hello',
- 123,
- true,
- {},
- function() {}
- ].forEach(function(input) {
-
- amanda.validate([input], schema, function(error) {
-
- a += 1;
-
- delete error[0].message;
-
- test.deepEqual(error[0], {
- property: '[0]',
- propertyValue: input,
- validator: 'type',
- validatorValue: 'array'
- });
-
- test.equal(error.length, 1);
-
- errorMethods.forEach(function(method) {
- test.ok(error[method]);
- });
-
- });
-
- });
-
- amanda.validate([[], 123], schema, function(error) {
-
- a += 1;
-
- delete error[0].message;
-
- test.deepEqual(error[0], {
- property: '[1]',
- propertyValue: 123,
- validator: 'type',
- validatorValue: 'array'
- });
-
- test.equal(error.length, 1);
-
- errorMethods.forEach(function(method) {
- test.ok(error[method]);
- });
-
- });
-
- amanda.validate([[]], schema, function(error) {
-
- a += 1;
-
- test.equal(error, undefined);
-
- });
-
- test.equal(a, 13);
- test.done();
-
-};
-
-/**
- * Test #4
- */
-exports['Test #4'] = function(test) {
-
- var a = 0;
-
- var schema = {
- type: 'array',
- items: {
- type: 'array',
- items: {
- type: 'array'
- }
- }
- };
-
- amanda.validate([], schema, function(error) {
-
- a += 1;
-
- test.equal(error, undefined);
-
- });
-
- amanda.validate([[]], schema, function(error) {
-
- a += 1;
-
- test.equal(error, undefined);
-
- });
-
- amanda.validate([[[]]], schema, function(error) {
-
- a += 1;
-
- test.equal(error, undefined);
-
- });
-
- amanda.validate([[123]], schema, function(error) {
-
- a += 1;
-
- delete error[0].message;
-
- test.deepEqual(error[0], {
- property: '[0][0]',
- propertyValue: 123,
- validator: 'type',
- validatorValue: 'array'
- });
-
- test.equal(error.length, 1);
-
- errorMethods.forEach(function(method) {
- test.ok(error[method]);
- });
-
- });
-
- amanda.validate([123], schema, function(error) {
-
- a += 1;
-
- delete error[0].message;
-
- test.deepEqual(error[0], {
- property: '[0]',
- propertyValue: 123,
- validator: 'type',
- validatorValue: 'array'
- });
-
- test.equal(error.length, 1);
-
- errorMethods.forEach(function(method) {
- test.ok(error[method]);
- });
-
- });
-
- test.equal(a, 5);
- test.done();
-
-};

0 comments on commit 05c4582

Please sign in to comment.