Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/.pnp
.pnp.js
.yarn/install-state.gz
bun.lock

# testing
/coverage
Expand Down
12 changes: 12 additions & 0 deletions __tests__/Home.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { test } from "vitest";
import { render } from "@testing-library/react"
import SamplePage from "@/app/sample/page";


test("Sample page render", () => {
render(<SamplePage />)
console.log("Sampel page render Success")

})


8 changes: 4 additions & 4 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { CategoryMenu, Hero, Incentives, IntroducingSection, Newsletter, Product
export default function Home() {
return (
<>
<Hero />
<IntroducingSection />
<CategoryMenu />
<ProductsSection />
<Hero />
<IntroducingSection />
<CategoryMenu />
<ProductsSection />
</>
);
}
9 changes: 9 additions & 0 deletions app/sample/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const SamplePage = () => {
return (
<div>
<h4>Same Page</h4>
</div>
)
}

export default SamplePage
835 changes: 450 additions & 385 deletions bun.lock

Large diffs are not rendered by default.

18 changes: 16 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"build": "prisma generate && next build",
"start": "next start",
"lint": "next lint",
"test": "vitest"
"db:generate": "prisma generate",
"db:push": "prisma db push",
"db:studio": "prisma studio"
Expand All @@ -16,8 +17,6 @@
"@prisma/client": "^6.16.1",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.10",
"@types/bcryptjs": "^2.4.6",
"@types/react-slick": "^0.23.13",
"bcryptjs": "^2.4.3",
"date-fns": "^4.1.0",
"dompurify": "^3.0.8",
Expand All @@ -39,6 +38,18 @@
"zustand": "^4.5.1"
},
"devDependencies": {
"@types/bcryptjs": "^2.4.6",
"@types/react-slick": "^0.23.13",
"@testing-library/react": "^16.3.0",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@vitejs/plugin-react": "^5.0.2",
"autoprefixer": "^10.0.1",
"daisyui": "^4.7.2",
"eslint": "^8",
"eslint-config-next": "14.1.0",
"jsdom": "^26.1.0",
"@types/dompurify": "^3.0.5",
"@types/node": "^24.3.3",
"@types/react": "^18.3.24",
Expand All @@ -50,6 +61,9 @@
"postcss": "^8",
"prisma": "^6.16.1",
"tailwindcss": "^3.3.0",
"typescript": "^5",
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^3.2.4"
"typescript": "^5.9.2"
}
}
14 changes: 14 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths';

export default defineConfig({
plugins: [react(), tsconfigPaths()],
test: {
globals: true,
environment: 'jsdom',
setupFiles: "./vitest.setup.ts",

exclude: ["./node_modules/"]
},
})
18 changes: 18 additions & 0 deletions vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

import "@testing-library/jest-dom";
import { vi } from "vitest";

// Polyfill for matchMedia (needed by react-slick / enquire.js)
Object.defineProperty(window, "matchMedia", {
writable: true,
value: vi.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addListener: vi.fn(), // deprecated
removeListener: vi.fn(), // deprecated
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
})),
});