Skip to content

Commit

Permalink
refactor test files and update coverage settings (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
guibranco authored Nov 22, 2024
1 parent fc0ea0e commit cff6094
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 27 deletions.
11 changes: 0 additions & 11 deletions src/main.test.tsx

This file was deleted.

13 changes: 6 additions & 7 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.tsx'
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./App.tsx";

createRoot(document.getElementById('root')!).render(
createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>,
)
</StrictMode>
);
2 changes: 1 addition & 1 deletion src/App.test.tsx → test/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, screen } from '@testing-library/react';
import { describe, it, expect } from 'vitest';
import App from './App';
import App from '../src/App';

describe('App Component', () => {
it('renders the Header component', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render, screen } from '@testing-library/react';
import Footer from './Footer';
import Footer from '../../src/components/Footer';

describe('Footer Component', () => {
it('renders the developer information', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render, screen } from '@testing-library/react';
import Header from './Header';
import Header from '../../src/components/Header';

describe('Header Component', () => {
it('renders the API BR logo and title', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, screen, fireEvent } from "@testing-library/react";
import ProjectCard from "./ProjectCard";
import { Project } from "../types";
import ProjectCard from "../../src/components/ProjectCard";
import { Project } from "../../src/types";

describe("ProjectCard Component", () => {
const mockProject: Project = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, screen } from "@testing-library/react";
import ProjectGrid from "./ProjectGrid";
import { Project } from "../types";
import ProjectGrid from "../../src/components/ProjectGrid";
import { Project } from "../../src/types";

// Mock data for testing
const mockProjects: Project[] = [
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["src"]
"include": ["test", "test/setupTests.ts"]
}
4 changes: 3 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ export default defineConfig({
test: {
globals: true,
environment: 'jsdom',
setupFiles: './src/setupTests.ts',
setupFiles: './test/setupTests.ts',
coverage: {
reporter: ['text', 'html', 'lcov'],
include: ['src/**/*.{ts,tsx}'],
exclude: ['node_modules', 'test/**/*', 'src/main.tsx', 'src/*.d.ts'],
},
},
});

0 comments on commit cff6094

Please sign in to comment.