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>
28 lines
902 B
Text
28 lines
902 B
Text
/* eslint-disable no-console, @typescript-eslint/ban-ts-comment */
|
|
import { nopeResolver } from '..';
|
|
import { fields, invalidData, schema, validData } from './__fixtures__/data';
|
|
|
|
const shouldUseNativeValidation = false;
|
|
|
|
describe('nopeResolver', () => {
|
|
it('should return values from nopeResolver when validation pass', async () => {
|
|
const schemaSpy = vi.spyOn(schema, 'validate');
|
|
|
|
const result = await nopeResolver(schema)(validData, undefined, {
|
|
fields,
|
|
shouldUseNativeValidation,
|
|
});
|
|
|
|
expect(schemaSpy).toHaveBeenCalledTimes(1);
|
|
expect(result).toEqual({ errors: {}, values: validData });
|
|
});
|
|
|
|
it('should return a single error from nopeResolver when validation fails', async () => {
|
|
const result = await nopeResolver(schema)(invalidData, undefined, {
|
|
fields,
|
|
shouldUseNativeValidation,
|
|
});
|
|
|
|
expect(result).toMatchSnapshot();
|
|
});
|
|
});
|