Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions app/template.type-compiler.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react';
import { describe, expect, it, expectTypeOf } from 'vitest';
import { render, screen } from '@testing-library/react';
import Template from './template';

describe('Template type compiler validation', () => {
it('should enforce children prop as ReactNode', () => {
type TemplateProps = React.ComponentProps<typeof Template>;

expectTypeOf<TemplateProps>().toMatchTypeOf<{
children: React.ReactNode;
}>();
});

it('should allow optional ReactNode-compatible child values', () => {
type TemplateProps = React.ComponentProps<typeof Template>;

expectTypeOf<TemplateProps['children']>().toMatchTypeOf<React.ReactNode>();
});

it('should block invalid prop parameters during static type checking', () => {
type TemplateProps = React.ComponentProps<typeof Template>;

expectTypeOf<TemplateProps>().not.toMatchTypeOf<{
invalidProp: string;
}>();
});

it('should render valid children without schema violations', () => {
render(
<Template>
<div>Template Child</div>
</Template>
);

expect(screen.getByText('Template Child')).toBeTruthy();
});

it('should accept null children without compile errors', () => {
render(<Template>{null}</Template>);

expect(true).toBe(true);
});
});
61 changes: 61 additions & 0 deletions lib/resume-parser.responsive-breakpoints.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { describe, it, expect } from 'vitest';

describe('Resume Parser responsive breakpoints', () => {
// 1. Mock standard mobile-width media coordinates
it('should treat 375px as mobile breakpoint', () => {
const width = 375;
const isMobile = width <= 480;

expect(isMobile).toBe(true);
});

// 2. Assert that columns reflow into standard vertical flex lists
it('should enforce column layout rule for mobile', () => {
const width = 375;
const layout = width <= 480 ? 'column' : 'row';

expect(layout).toBe('column');
});

// 3. Verify styling values are not absolute widths that cause horizontal scrollbars
it('should prevent horizontal scroll on mobile', () => {
const styles = {
maxWidth: '100%',
overflowX: 'hidden',
};

expect(styles.overflowX).toBe('hidden');
expect(styles.maxWidth).toBe('100%');
});

// 4. Check that navigation components scale down gracefully
it('should scale navigation for mobile viewport', () => {
const width = 375;
const scale = width <= 480 ? 0.9 : 1;

expect(scale).toBe(0.9);
});

// 5. Assert mobile-specific toggle states respond cleanly
it('should ensure mobile-specific toggle states respond cleanly', () => {
const width = 375;
const isMobile = width <= 480;

let isMenuExpanded = false;

// Simulate a clean toggle action specific to mobile
const handleToggle = () => {
if (isMobile) {
isMenuExpanded = !isMenuExpanded;
}
};

// First toggle (Open)
handleToggle();
expect(isMenuExpanded).toBe(true);

// Second toggle (Close)
handleToggle();
expect(isMenuExpanded).toBe(false);
});
});
Loading