MCPcopy
hub / github.com/sequelize/sequelize / applyPassTest

Function applyPassTest

test/unit/model/validation.test.js:204–230  ·  test/unit/model/validation.test.js::applyPassTest
(validatorDetails, j, validator, type)

Source from the content-addressed store, hash-verified

202 });
203 },
204 applyPassTest = function applyPassTest(validatorDetails, j, validator, type) {
205 const succeedingValue = validatorDetails.pass[j];
206 it(`correctly specifies an instance as valid using a value of class="st">"${succeedingValue}" for the validation class="st">"${validator}"`, async function() {
207 const validations = {},
208 message = `${validator}(${succeedingValue})`;
209
210 validations[validator] = validatorDetails.spec || {};
211
212 if (type === class="st">'msg') {
213 validations[validator].msg = message;
214 } else if (type === class="st">'args') {
215 validations[validator].args = validations[validator].args || true;
216 validations[validator].msg = message;
217 } else if (type === class="st">'true') {
218 validations[validator] = true;
219 }
220
221 const UserSuccess = this.sequelize.define(`User${Support.rand()}`, {
222 name: {
223 type: Sequelize.STRING,
224 validate: validations
225 }
226 });
227 const successfulUser = UserSuccess.build({ name: succeedingValue });
228 await expect(successfulUser.validate()).not.to.be.rejected;
229 });
230 };
231
232 for (let validator in checks) {
233 if (checks.hasOwnProperty(validator)) {

Callers 1

validation.test.jsFile · 0.85

Calls 3

defineMethod · 0.80
buildMethod · 0.80
validateMethod · 0.65

Tested by

no test coverage detected