不要怂,就是干,撸起袖子干!

indent changes based on new code updates

1 parent 9c99552e
...@@ -69,7 +69,6 @@ DaoValidator.prototype.hookValidate = function() { ...@@ -69,7 +69,6 @@ DaoValidator.prototype.hookValidate = function() {
} }
// private // private
var validateModel = function() { var validateModel = function() {
Utils._.each(this.model.__options.validate, function(_validator, validatorType) { Utils._.each(this.model.__options.validate, function(_validator, validatorType) {
var validator = prepareValidationOfAttribute.call(this, undefined, _validator, validatorType, { omitValue: true }) var validator = prepareValidationOfAttribute.call(this, undefined, _validator, validatorType, { omitValue: true })
...@@ -79,7 +78,7 @@ var validateModel = function() { ...@@ -79,7 +78,7 @@ var validateModel = function() {
if (err) { if (err) {
var error = {}; var error = {};
error[DaoValidator.RAW_KEY_NAME] = err; error[DaoValidator.RAW_KEY_NAME] = err
var msg = ((err instanceof Error) ? err.message : err) var msg = ((err instanceof Error) ? err.message : err)
error[validatorType] = [msg] error[validatorType] = [msg]
......
...@@ -8,7 +8,7 @@ var chai = require('chai') ...@@ -8,7 +8,7 @@ var chai = require('chai')
chai.Assertion.includeStack = true chai.Assertion.includeStack = true
describe(Support.getTestDialectTeaser("DaoValidator"), function() { describe(Support.getTestDialectTeaser("DaoValidator"), function() {
describe.only('validations', function() { describe('validations', function() {
var checks = { var checks = {
is: { is: {
spec: { args: ["[a-z]",'i'] }, spec: { args: ["[a-z]",'i'] },
...@@ -476,7 +476,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() { ...@@ -476,7 +476,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
}) })
}) })
it('correctly validates using custom validation methods', function(done) { it.only('correctly validates using custom validation methods', function(done) {
var User = this.sequelize.define('User' + config.rand(), { var User = this.sequelize.define('User' + config.rand(), {
name: { name: {
type: Sequelize.STRING, type: Sequelize.STRING,
...@@ -495,6 +495,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() { ...@@ -495,6 +495,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
var failingUser = User.build({ name : "3" }) var failingUser = User.build({ name : "3" })
failingUser.validate().success(function(errors) { failingUser.validate().success(function(errors) {
console.log('ERR:\n', errors, '\n\n', errors.name, '\n\n');
expect(errors).to.deep.equal({ name: ["name should equal '2'"] }) expect(errors).to.deep.equal({ name: ["name should equal '2'"] })
var successfulUser = User.build({ name : "2" }) var successfulUser = User.build({ name : "2" })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!