发送到Passport错误桶风帆的属性无效

时间:2015-07-26 14:26:10

标签: node.js unit-testing sails.js mocha waterline

我正在申请帆。我正在使用桶将数据填充到我的模型中。

填写用户后填写护照时出现以下错误。以下是我的user.json和passport.json

[
  {
    "communityID": 1,
    "email": "testuser@getintuch.com",
    "ownershipGroups": [1],
    "membershipGroups": [1]
  }
]
[
  {
    "protocol": "local",
    "password": "random",
    "accessToken": "random",
    "user": 1
  }
]

barrels.populate(['user'], function (err) {
  if (err) return done(err);
  barrels.populate(['passport'], function (err) {
    if (err) return done(err);
    done(err, sails);
  });
});

以下是我得到的错误

Error (E_VALIDATION) :: 1 attribute is invalid
    at WLValidationError.WLError (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/lib/waterline/error/WLError.js:26:15)
    at new WLValidationError (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/lib/waterline/error/WLValidationError.js:20:28)
    at /Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/lib/waterline/query/validate.js:45:43
    at allValidationsChecked (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:198:5)
    at /Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:49:16
    at done (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:239:19)
    at /Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:40:16
    at /Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:189:14
    at /Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:49:16
    at done (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:239:19)
    at /Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:40:16
    at /Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:152:64
    at /Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:162:20
    at /Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:230:13
    at _arrayEach (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:81:9)
    at _each (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:72:13)
    at Object.async.forEachOf.async.eachOf (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:229:9)
    at Object.async.forEach.async.each (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:206:22)
    at validate (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:151:11)
    at /Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:162:20
    at /Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:230:13
    at _arrayEach (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:81:9)
    at _each (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:72:13)
    at Object.async.forEachOf.async.eachOf (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:229:9)
    at Object.async.forEach.async.each (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:206:22)
    at Validator.validate (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:195:9)
    at /Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/lib/waterline/query/validate.js:41:25
    at /Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:699:13
    at iterate (/Users/santosh/Development/intuch/ontatch/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:256:13)
    at process._tickDomainCallback (node.js:381:11)

Invalid attributes sent to Passport:
 • user
   • "required" validation rule failed for input: null

  1) "before all" hook

  0 passing (5s)
  1 failing

  1)  "before all" hook:
     [Error (E_VALIDATION) 1 attribute is invalid] Invalid attributes sent to Passport:
 • user
   • "required" validation rule failed for input: null

  Error (E_VALIDATION) :: 1 attribute is invalid
  Error (E_VALIDATION) :: 1 attribute is invalid

0 个答案:

没有答案