Migrate content from markdown to Appwrite database
Remove static markdown file dependencies and update all pages/components to fetch data directly from Appwrite collections, while maintaining existing service functions for data retrieval and adding new CRUD operations for projects.
This commit is contained in:
1 parent
7e3b5b7a55
commit
03a79e2f79
18 files changed
+1990
-5876
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { render } from '@solidjs/testing-library';
|
||||
import Blog from '../Blog';
|
||||
|
||||
// Mock data for testing
|
||||
const mockTags = ['technology', 'web development', 'astro'];
|
||||
const mockData = [
|
||||
{
|
||||
id: '1',
|
||||
slug: 'test-post',
|
||||
body: 'Test post content',
|
||||
collection: 'blog',
|
||||
data: {
|
||||
title: 'Test Post',
|
||||
summary: 'A test post',
|
||||
date: new Date(),
|
||||
tags: ['technology'],
|
||||
draft: false,
|
||||
template: 'default',
|
||||
featured: false
|
||||
},
|
||||
render: async () => ({
|
||||
Content: () => null,
|
||||
headings: [],
|
||||
remarkPluginFrontmatter: {}
|
||||
})
|
||||
}
|
||||
];
|
||||
|
||||
describe('Blog Component', () => {
|
||||
it('should render without crashing', () => {
|
||||
const { container } = render(() => (
|
||||
<Blog tags={mockTags} data={mockData} />
|
||||
));
|
||||
|
||||
expect(container).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should display the correct number of posts', () => {
|
||||
const { container } = render(() => (
|
||||
<Blog tags={mockTags} data={mockData} />
|
||||
));
|
||||
|
||||
// Should have at least one post displayed
|
||||
const postElements = container.querySelectorAll('li');
|
||||
expect(postElements.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user