<commit_before>var assert = require('assert');
var async = require('async');

var App = require('./helpers/app');
var req = require('./helpers/req');

var port = process.env.NODE_HTTP_PORT || 8888;
var url = 'http://localhost:' + port;

// Nested parameters are also supported

var validation = function(req, res) {
  req.assert(['user', 'fields', 'email'], 'not empty').notEmpty();
  req.assert(['user', 'fields', 'email'], 'valid email required').isEmail();

  var errors = req.validationErrors();
  if (errors) {
    res.json(errors);
    return;
  }
  res.json(req.body);
};
var app = new App(port, validation);
app.start();

function fail(body) {
  assert.deepEqual(body[0].msg, 'not empty');
  assert.deepEqual(body[1].msg, 'valid email required');
}
function pass(body) {
  assert.deepEqual(body, {
    user: {
      fields: {
        email: '<EMAIL>'
      }
    }
  });
}

var tests = [
  async.apply(req, 'post', url + '/', {
    json: {
      user: {
        fields: {
          email: '<EMAIL>'
        }
      }
    }
  }, pass),
  async.apply(req, 'post', url + '/', {
    json: {
      user: {
        fields: {
          email: ''
        }
      }
    }
  }, fail)
];

async.parallel(tests, function(err) {
  assert.ifError(err);
  app.stop();
  console.log('All %d tests passed.', tests.length);
});
<commit_msg>Updated test for testing nested dot notation<commit_after>var assert = require('assert');
var async = require('async');

var App = require('./helpers/app');
var req = require('./helpers/req');

var port = process.env.NODE_HTTP_PORT || 8888;
var url = 'http://localhost:' + port;

// Nested parameters are also supported

var validation = function(req, res) {
  req.assert('user.fields.email', 'not empty').notEmpty();
  req.assert(['user', 'fields', 'email'], 'valid email required').isEmail();

  var errors = req.validationErrors();
  if (errors) {
    res.json(errors);
    return;
  }
  res.json(req.body);
};
var app = new App(port, validation);
app.start();

function fail(body) {
  assert.deepEqual(body[0].msg, 'not empty');
  assert.deepEqual(body[1].msg, 'valid email required');
}
function pass(body) {
  assert.deepEqual(body, {
    user: {
      fields: {
        email: '<EMAIL>'
      }
    }
  });
}

var tests = [
  async.apply(req, 'post', url + '/', {
    json: {
      user: {
        fields: {
          email: '<EMAIL>'
        }
      }
    }
  }, pass),
  async.apply(req, 'post', url + '/', {
    json: {
      user: {
        fields: {
          email: ''
        }
      }
    }
  }, fail)
];

async.parallel(tests, function(err) {
  assert.ifError(err);
  app.stop();
  console.log('All %d tests passed.', tests.length);
});

{'fraction_non_alphanumeric': 0.190831159150205, 'fraction_numerical': 0.004472605292582929, 'mean_word_length': 2.732962447844228, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4689240', 'n_tokens_mistral': 907, 'n_tokens_neox': 902, 'n_words': 200}