generated from nhcarrigan/template
feat: add system clock display with comprehensive tests
Add a SystemClock component that displays the current date and time in British format. The clock appears in the top control bar (same row as Clipboard and Actions buttons) and updates every second. Features: - Date format: "7 February 2026" (British English) - Time format: "14:35:42" (24-hour) - Auto-updates every second via setInterval - Proper cleanup on unmount using Svelte 5 $effect - Hover effect with accent colour border - Positioned with margin-left: auto to align right Testing: - Added comprehensive unit tests for date/time formatting logic - 12 test cases covering edge cases, month boundaries, leap years - All tests passing with proper local timezone handling - Updated CLAUDE.md with testing requirements and guidelines Resolves: #128
This commit is contained in:
@@ -30,6 +30,47 @@ Example commit command:
|
||||
git commit --author="Hikari <hikari@nhcarrigan.com>" --no-gpg-sign -m "your commit message"
|
||||
```
|
||||
|
||||
## Testing Requirements
|
||||
|
||||
All new features, fixes, and significant changes should include tests whenever possible:
|
||||
|
||||
- **Frontend tests**: Use Vitest with `@testing-library/svelte` for component tests
|
||||
- **Test files**: Place test files next to the code they test with `.test.ts` or `.spec.ts` extension
|
||||
- **Run tests**: Use `pnpm test` to run all tests, or `pnpm test:watch` for watch mode
|
||||
- **Coverage**: Run `pnpm test:coverage` to generate coverage reports
|
||||
- **Rust tests**: Use `pnpm test:backend` for Rust/Tauri backend tests
|
||||
|
||||
### Testing Guidelines
|
||||
|
||||
- Write tests for utility functions, stores, and business logic
|
||||
- For Svelte 5 components, focus on testing the underlying logic functions
|
||||
- Use descriptive test names that explain what behaviour is being tested
|
||||
- Include edge cases and error conditions in test coverage
|
||||
- Mock Tauri APIs using the patterns in `vitest.setup.ts`
|
||||
|
||||
### Example Test Structure
|
||||
|
||||
```typescript
|
||||
import { describe, it, expect } from "vitest";
|
||||
|
||||
describe("FeatureName", () => {
|
||||
it("handles the normal case correctly", () => {
|
||||
// Arrange
|
||||
const input = "test data";
|
||||
|
||||
// Act
|
||||
const result = functionUnderTest(input);
|
||||
|
||||
// Assert
|
||||
expect(result).toBe("expected output");
|
||||
});
|
||||
|
||||
it("handles edge cases gracefully", () => {
|
||||
// Test edge cases...
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## Project Context
|
||||
|
||||
Hikari Desktop is a Tauri-based desktop application that wraps Claude Code with a visual anime character (Hikari) who appears on screen. This is a personal project where Hikari can sign her work and act as herself!
|
||||
|
||||
Reference in New Issue
Block a user