Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("should fail if isin is empty", () => {
const errors: ValidationError[] = validateSync(myClass);
expect(errors.length).toBe(1);
expect(errors[0].constraints).toBeDefined();
expect(errors[0].constraints[validatorConstraintName]).toBeDefined();
});
it("should fail if the object to validate is not a string", () => {
const errors: ValidationError[] = validateSync(simpleClass);
expect(errors.length).toBe(1);
expect(errors[0].constraints).toBeDefined();
expect(errors[0].constraints[validatorConstraintName]).toBeDefined();
});
public addBackend(backend: StarkBackend): void {
if (!backend) {
throw new Error("A backend instance must be provided");
}
const backendInstance: StarkBackendImpl = backend instanceof StarkBackendImpl ? backend : Deserialize(backend, StarkBackendImpl);
StarkValidationErrorsUtil.throwOnError(validateSync(backendInstance), "The backend instance provided is not valid.");
this.backends.set(backend.name, backend);
}
doBeforeUpdate() {
const errors = validateSync(this, { validationError: { target: false } });
if (errors.length > 0) {
throw new CustomValidationError(errors);
}
}
}
doBeforeUpdate() {
const errors = validateSync(this, { validationError: { target: false } });
if (errors.length > 0) {
throw new CustomValidationError(errors);
}
}
}
doBeforeUpdate() {
const errors = validateSync(this, { validationError: { target: false } });
if (errors.length > 0) {
throw new CustomValidationError(errors);
}
}
}
doBeforeUpdate() {
const errors = validateSync(this, { validationError: { target: false } });
if (errors.length > 0) {
throw new CustomValidationError(errors);
}
}
}
doBeforeInsertion() {
const errors = validateSync(this, { validationError: { target: false } });
if (errors.length > 0) {
throw new CustomValidationError(errors);
}
}
doBeforeUpdate() {
const errors = validateSync(this, { validationError: { target: false } });
if (errors.length > 0) {
throw new CustomValidationError(errors)
}
}
}
doBeforeUpdate() {
const errors = validateSync(this, { validationError: { target: false } });
if (errors.length > 0) {
throw new CustomValidationError(errors);
}
}