Home

A commitment to helping businesses and individuals excel in their goals

Hasselbring Consulting, LLC is a business that seamlessly merges goals and strategies to assist you in excelling in life.

Building exterior in Toronto, Canada

A passion for building value

Our sole purpose is to bring your strengths to the forefront so that your value to others can be seen and used.

Tourist taking photo of a building

Craig Hasselbring

CEO

import { describe, it, expect } from 'vitest';
import { appRouter } from './routers';

describe('Contact Form & Affiliate Tracking', () => {
  it('should submit contact form successfully', async () => {
    const caller = appRouter.createCaller({
      user: null,
      req: {} as any,
      res: {} as any,
    });

    const result = await caller.contact.submit({
      name: 'John Doe',
      email: 'john@example.com',
      phone: '555-1234',
      package: 'Basic Website ($500)',
      message: 'I need a website for my church. Can you help?',
    });

    expect(result.success).toBe(true);
    expect(result.message).toContain('Thank you');
  });

  it('should validate contact form input', async () => {
    const caller = appRouter.createCaller({
      user: null,
      req: {} as any,
      res: {} as any,
    });

    // Should reject invalid email
    await expect(
      caller.contact.submit({
        name: 'John',
        email: 'invalid-email',
        message: 'Test message',
      })
    ).rejects.toThrow();

    // Should reject short message
    await expect(
      caller.contact.submit({
        name: 'John',
        email: 'john@example.com',
        message: 'Short',
      })
    ).rejects.toThrow();
  });

  it('should have contact router configured', () => {
    const caller = appRouter.createCaller({
      user: null,
      req: {} as any,
      res: {} as any,
    });

    expect(caller.contact).toBeDefined();
    expect(typeof caller.contact.submit).toBe('function');
  });

  it('should have affiliate tracking endpoints', () => {
    const caller = appRouter.createCaller({
      user: null,
      req: {} as any,
      res: {} as any,
    });

    expect(caller.affiliate).toBeDefined();
    expect(typeof caller.affiliate.trackClick).toBe('function');
    expect(typeof caller.affiliate.recordConversion).toBe('function');
  });
});