ChatTESTING.md11 matches
5## Overview
67The application uses **Deno** as the test runner with **React Testing Library** for component testing. Tests are written in TypeScript and follow modern testing practices with proper mocking and isolation.
89## Quick Start
2829- **Test Runner**: Deno Test
30- **Component Testing**: React Testing Library
31- **Assertions**: Deno Standard Library Assert
32- **Mocking**: Custom utilities + built-in Deno mocks
5051```typescript
52/** @jsxImportSource https://esm.sh/react@18.2.0 */
53import { assertEquals, assertExists } from "https://deno.land/std@0.208.0/assert/mod.ts";
54import { render, cleanup } from "https://esm.sh/@testing-library/react@14.0.0?deps=react@18.2.0,react-dom@18.2.0";
55import React from "https://esm.sh/react@18.2.0";
56import { createMockMessage } from "../utils/test-helpers.ts";
57import ComponentToTest from "../../frontend/components/ComponentToTest.tsx";
363### Common Issues
3643651. **Import Errors**: Ensure React version pinning in imports
3662. **Component Not Rendering**: Check required props
3673. **Async Issues**: Use proper async/await patterns
431432```typescript
433/** @jsxImportSource https://esm.sh/react@18.2.0 */
434import { assertEquals, assertExists } from "https://deno.land/std@0.208.0/assert/mod.ts";
435import { render, cleanup } from "https://esm.sh/@testing-library/react@14.0.0?deps=react@18.2.0,react-dom@18.2.0";
436import React from "https://esm.sh/react@18.2.0";
437import { createMockMessage } from "../utils/test-helpers.ts";
438import NewComponent from "../../frontend/components/NewComponent.tsx";
454455- [Deno Testing Documentation](https://deno.land/manual/testing)
456- [React Testing Library Documentation](https://testing-library.com/docs/react-testing-library/intro/)
457- [Deno Standard Library Assert](https://deno.land/std/assert)
458- [ESM.sh for React Dependencies](https://esm.sh/)
459460## Contributing
71```typescript
72import { assertEquals, assertExists } from "https://deno.land/std@0.208.0/assert/mod.ts";
73import { render, cleanup } from "https://esm.sh/@testing-library/react@14.0.0?deps=react@18.2.0,react-dom@18.2.0";
7475Deno.test("Component Name - Test Category", async (t) => {
102The test environment includes:
103104- **React Testing Library**: For component testing
105- **Deno Standard Library**: For assertions
106- **Mock DOM**: Simulated browser environment
138### Common Issues
139140- **Import Errors**: Ensure all imports use the correct ESM URLs with React version pinning
141- **Component Not Rendering**: Check that all required props are provided
142- **Mock Issues**: Verify that mocks are properly set up in setup.ts
ChatMessage.test.tsx4 matches
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import { assertEquals, assertExists, assertStringIncludes } from "https://deno.land/std@0.208.0/assert/mod.ts";
3import { render } from "https://esm.sh/@testing-library/react@14.0.0?deps=react@18.2.0,react-dom@18.2.0";
4import { cleanup } from "https://esm.sh/@testing-library/react@14.0.0/cleanup?deps=react@18.2.0,react-dom@18.2.0";
5import React from "https://esm.sh/react@18.2.0";
6import MessageComponent from "../../frontend/components/Message.tsx";
7import type { Message } from "../../frontend/components/App.tsx";
Chatpackage.json5 matches
16"mcp",
17"chat",
18"react",
19"typescript"
20],
22"license": "MIT",
23"devDependencies": {
24"@types/react": "^18.2.0",
25"@types/react-dom": "^18.2.0"
26},
27"dependencies": {
28"react": "^18.2.0",
29"react-dom": "^18.2.0"
30}
31}
linkInBioTemplatemain.tsx2 matches
1/** @jsxImportSource https://esm.sh/react */
2import { renderToString } from "npm:react-dom/server";
34export default async function(req: Request) {
linkInBioTemplatemain.tsx2 matches
1/** @jsxImportSource https://esm.sh/react */
2import { renderToString } from "npm:react-dom/server";
34export default async function(req: Request) {
WS-Chesstypes.d.ts11 matches
1declare module 'react' {
2export interface ReactElement {
3type: string | ComponentClass<any>;
4props: any;
6}
78export type ReactNode =
9| string
10| number
11| ReactElement
12| null
13| undefined
14| ReactNode[];
1516export interface ComponentProps<T> {
17children?: ReactNode;
18}
1931type: string | ComponentClass<any>,
32props?: any,
33...children: ReactNode[]
34): ReactElement;
3536export function useState<S>(initialState: S | (() => S)): [S, (newValue: S) => void];
3738export const StrictMode: ComponentClass<{ children?: ReactNode }>;
3940export namespace JSX {
49props: any,
50key?: string | number
51): ReactElement;
52}
5356container: Element | Document | null
57): {
58render(element: ReactElement): void;
59unmount(): void;
60};
1import App from './src/App';
23const root = window.ReactDOM.createRoot(document.getElementById('root')!);
4root.render(
5window.React.createElement(window.React.StrictMode, {},
6window.React.createElement(App as typeof window.React.Component, {}, undefined)
7)
8);
stevensDemotypes.ts1 match
1/**
2* @jsxImportSource https://esm.sh/react@18.2.0
3*/
4
stevensDemoREADME.md1 match
1# React Hono Val Town Project Starter Template
23This is a starter template for a full-stack app in a Val Town Project. The app itself is a simple persistent message board.