Rocky_Mountain_Vending/.pnpm-store/v10/files/3b/d998eb5d32fef455f5dad806c103274eff7218ac350c5958e7d04f951c91010c2da014157b14d4b3aa6854a319fb7e6b5cd6c1c03b8980216fa1eba3c8bce1
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

67 lines
1.5 KiB
Text

import { Field, InternalFieldName } from 'react-hook-form';
import * as vest from 'vest';
export const validationSuite = vest.create('form', (data: any = {}) => {
vest.test('username', 'Username is required', () => {
vest.enforce(data.username).isNotEmpty();
});
vest.test('username', 'Must be longer than 3 chars', () => {
vest.enforce(data.username).longerThan(3);
});
vest.test('deepObject.data', 'deepObject.data is required', () => {
vest.enforce(data.deepObject.data).isNotEmpty();
});
vest.test('password', 'Password is required', () => {
vest.enforce(data.password).isNotEmpty();
});
vest.test('password', 'Password must be at least 5 chars', () => {
vest.enforce(data.password).longerThanOrEquals(5);
});
vest.test('password', 'Password must contain a digit', () => {
vest.enforce(data.password).matches(/[0-9]/);
});
vest.test('password', 'Password must contain a symbol', () => {
vest.enforce(data.password).matches(/[^A-Za-z0-9]/);
});
});
export const validData = {
username: 'asdda',
password: 'asddfg123!',
deepObject: {
data: 'test',
},
};
export const invalidData = {
username: '',
password: 'a',
deepObject: {
data: '',
},
};
export const fields: Record<InternalFieldName, Field['_f']> = {
username: {
ref: { name: 'username' },
name: 'username',
},
password: {
ref: { name: 'password' },
name: 'password',
},
email: {
ref: { name: 'email' },
name: 'email',
},
birthday: {
ref: { name: 'birthday' },
name: 'birthday',
},
};