refactor(yachts): rename schema + consolidate tests per project conventions

This commit is contained in:
Matt Ciaccio
2026-04-23 23:35:30 +02:00
parent 899e588a0c
commit 27d438929b
5 changed files with 83 additions and 59 deletions

View File

@@ -1,49 +0,0 @@
import { describe, it, expect } from 'vitest';
import { createYachtSchema, transferOwnershipSchema } from '@/lib/validators/yachts';
describe('createYachtSchema', () => {
it('rejects empty name', () => {
const result = createYachtSchema.safeParse({
name: '',
owner: { type: 'client', id: 'c1' },
});
expect(result.success).toBe(false);
});
it('requires owner', () => {
const result = createYachtSchema.safeParse({ name: 'Sea Breeze' });
expect(result.success).toBe(false);
});
it('rejects invalid yearBuilt', () => {
const result = createYachtSchema.safeParse({
name: 'Sea Breeze',
owner: { type: 'client', id: 'c1' },
yearBuilt: 1700,
});
expect(result.success).toBe(false);
});
it('accepts minimal valid input', () => {
const result = createYachtSchema.safeParse({
name: 'Sea Breeze',
owner: { type: 'client', id: 'c1' },
});
expect(result.success).toBe(true);
});
});
describe('transferOwnershipSchema', () => {
it('requires newOwner + effectiveDate', () => {
expect(transferOwnershipSchema.safeParse({}).success).toBe(false);
});
it('accepts valid input', () => {
const result = transferOwnershipSchema.safeParse({
newOwner: { type: 'company', id: 'co1' },
effectiveDate: new Date(),
transferReason: 'sale',
});
expect(result.success).toBe(true);
});
});