feat: update Projects component with framer-motion variants and improve animations
refactor: modify layout to use ClientOnly and BackgroundBlobsClient components fix: correct import statement for ActivityFeed in the main page fix: enhance sitemap fetching logic with error handling and mock support refactor: convert BackgroundBlobs to default export for consistency refactor: simplify ErrorBoundary component and improve error handling UI chore: update framer-motion to version 12.24.10 in package.json and package-lock.json test: add minimal Prisma Client mock for testing purposes feat: create BackgroundBlobsClient for dynamic import of BackgroundBlobs feat: implement ClientOnly component to handle client-side rendering feat: add custom error handling components for better user experience
This commit is contained in:
@@ -1,8 +1,44 @@
|
||||
jest.mock('next/server', () => ({
|
||||
NextResponse: jest.fn().mockImplementation(function (body, init) {
|
||||
// Use function and assign to `this` so `new NextResponse(...)` returns an instance with properties
|
||||
// eslint-disable-next-line no-invalid-this
|
||||
this.body = body;
|
||||
// eslint-disable-next-line no-invalid-this
|
||||
this.init = init;
|
||||
}),
|
||||
}));
|
||||
|
||||
import { GET } from '@/app/api/sitemap/route';
|
||||
import { mockFetch } from '@/app/__tests__/__mocks__/mock-fetch';
|
||||
|
||||
jest.mock('next/server', () => ({
|
||||
NextResponse: jest.fn().mockImplementation((body, init) => ({ body, init })),
|
||||
// Mock node-fetch so we don't perform real network requests in tests
|
||||
jest.mock('node-fetch', () => ({
|
||||
__esModule: true,
|
||||
default: jest.fn(() =>
|
||||
Promise.resolve({
|
||||
ok: true,
|
||||
json: () =>
|
||||
Promise.resolve({
|
||||
posts: [
|
||||
{
|
||||
id: '67ac8dfa709c60000117d312',
|
||||
title: 'Just Doing Some Testing',
|
||||
meta_description: 'Hello bla bla bla bla',
|
||||
slug: 'just-doing-some-testing',
|
||||
updated_at: '2025-02-13T14:25:38.000+00:00',
|
||||
},
|
||||
{
|
||||
id: '67aaffc3709c60000117d2d9',
|
||||
title: 'Blockchain Based Voting System',
|
||||
meta_description: 'This project aims to revolutionize voting systems by leveraging blockchain to ensure security, transparency, and immutability.',
|
||||
slug: 'blockchain-based-voting-system',
|
||||
updated_at: '2025-02-13T16:54:42.000+00:00',
|
||||
},
|
||||
],
|
||||
meta: { pagination: { limit: 'all', next: null, page: 1, pages: 1, prev: null, total: 2 } },
|
||||
}),
|
||||
})
|
||||
),
|
||||
}));
|
||||
|
||||
describe('GET /api/sitemap', () => {
|
||||
@@ -10,24 +46,24 @@ describe('GET /api/sitemap', () => {
|
||||
process.env.GHOST_API_URL = 'http://localhost:2368';
|
||||
process.env.GHOST_API_KEY = 'test-api-key';
|
||||
process.env.NEXT_PUBLIC_BASE_URL = 'https://dki.one';
|
||||
global.fetch = mockFetch({
|
||||
posts: [
|
||||
{
|
||||
id: '67ac8dfa709c60000117d312',
|
||||
title: 'Just Doing Some Testing',
|
||||
meta_description: 'Hello bla bla bla bla',
|
||||
slug: 'just-doing-some-testing',
|
||||
updated_at: '2025-02-13T14:25:38.000+00:00',
|
||||
},
|
||||
{
|
||||
id: '67aaffc3709c60000117d2d9',
|
||||
title: 'Blockchain Based Voting System',
|
||||
meta_description: 'This project aims to revolutionize voting systems by leveraging blockchain to ensure security, transparency, and immutability.',
|
||||
slug: 'blockchain-based-voting-system',
|
||||
updated_at: '2025-02-13T16:54:42.000+00:00',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// Provide mock posts via env so route can use them without fetching
|
||||
process.env.GHOST_MOCK_POSTS = JSON.stringify({ posts: [
|
||||
{
|
||||
id: '67ac8dfa709c60000117d312',
|
||||
title: 'Just Doing Some Testing',
|
||||
meta_description: 'Hello bla bla bla bla',
|
||||
slug: 'just-doing-some-testing',
|
||||
updated_at: '2025-02-13T14:25:38.000+00:00',
|
||||
},
|
||||
{
|
||||
id: '67aaffc3709c60000117d2d9',
|
||||
title: 'Blockchain Based Voting System',
|
||||
meta_description: 'This project aims to revolutionize voting systems by leveraging blockchain to ensure security, transparency, and immutability.',
|
||||
slug: 'blockchain-based-voting-system',
|
||||
updated_at: '2025-02-13T16:54:42.000+00:00',
|
||||
},
|
||||
] });
|
||||
});
|
||||
|
||||
it('should return a sitemap', async () => {
|
||||
|
||||
Reference in New Issue
Block a user