feat(docs): add pngs for README, move docs around

This commit is contained in:
perf3ct 2025-06-26 20:20:00 +00:00
parent b8ddd1b263
commit 7df2f98b5d
7 changed files with 0 additions and 278 deletions

BIN
docs/images/readur_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

View File

@ -1,258 +0,0 @@
#!/bin/bash
# Comprehensive test script for the label system
# This script runs both backend Rust tests and frontend React tests
set -e # Exit on any error
echo "🏷️ Running Label System Test Suite"
echo "=================================="
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Function to check if command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Check prerequisites
print_status "Checking prerequisites..."
if ! command_exists cargo; then
print_error "Cargo (Rust) is required but not installed"
exit 1
fi
if ! command_exists npm; then
print_error "npm is required but not installed"
exit 1
fi
if ! command_exists docker; then
print_warning "Docker not found - integration tests may fail"
fi
print_success "All prerequisites available"
# Backend Tests
echo
print_status "Running Backend (Rust) Tests..."
echo "================================="
# Unit tests
print_status "Running label unit tests..."
if cargo test labels_tests --lib; then
print_success "Label unit tests passed"
else
print_error "Label unit tests failed"
exit 1
fi
# Integration tests (if Docker is available)
if command_exists docker; then
print_status "Running label integration tests..."
if cargo test labels_integration_tests --test labels_integration_tests; then
print_success "Label integration tests passed"
else
print_error "Label integration tests failed"
exit 1
fi
else
print_warning "Skipping integration tests (Docker not available)"
fi
# All backend tests
print_status "Running all backend tests..."
if cargo test; then
print_success "All backend tests passed"
else
print_error "Some backend tests failed"
exit 1
fi
# Frontend Tests
echo
print_status "Running Frontend (React) Tests..."
echo "================================="
cd frontend
# Install dependencies if needed
if [ ! -d "node_modules" ]; then
print_status "Installing frontend dependencies..."
npm install
fi
# Run label component tests
print_status "Running Label component tests..."
if npm run test -- --run components/Labels/; then
print_success "Label component tests passed"
else
print_error "Label component tests failed"
exit 1
fi
# Run LabelsPage tests
print_status "Running LabelsPage tests..."
if npm run test -- --run pages/__tests__/LabelsPage.test.tsx; then
print_success "LabelsPage tests passed"
else
print_error "LabelsPage tests failed"
exit 1
fi
# Run all frontend tests
print_status "Running all frontend tests..."
if npm run test -- --run; then
print_success "All frontend tests passed"
else
print_error "Some frontend tests failed"
exit 1
fi
# Return to root directory
cd ..
# Test Coverage (optional)
echo
print_status "Generating Test Coverage Reports..."
echo "=================================="
# Backend coverage
print_status "Generating backend test coverage..."
if command_exists cargo-tarpaulin; then
cargo tarpaulin --out Html --output-dir target/coverage/backend -- labels_tests
print_success "Backend coverage report generated at target/coverage/backend/tarpaulin-report.html"
elif command_exists grcov; then
print_status "Using grcov for coverage..."
# Add grcov commands here if needed
else
print_warning "No coverage tool found (install cargo-tarpaulin or grcov for coverage reports)"
fi
# Frontend coverage
print_status "Generating frontend test coverage..."
cd frontend
if npm run test:coverage 2>/dev/null; then
print_success "Frontend coverage report generated"
else
print_warning "Frontend coverage generation failed or not configured"
fi
cd ..
# Database Migration Test
echo
print_status "Testing Database Migration..."
echo "============================"
if command_exists sqlx; then
print_status "Checking migration syntax..."
if sqlx migrate info --database-url "postgres://test:test@localhost/test" 2>/dev/null; then
print_success "Migration syntax is valid"
else
print_warning "Could not validate migration (database not available)"
fi
else
print_warning "sqlx-cli not found - skipping migration validation"
fi
# API Schema Validation
echo
print_status "Validating API Schema..."
echo "========================"
print_status "Checking Rust API types..."
if cargo check --lib; then
print_success "Rust API types are valid"
else
print_error "Rust API types have issues"
exit 1
fi
print_status "Checking TypeScript types..."
cd frontend
if npm run type-check 2>/dev/null; then
print_success "TypeScript types are valid"
else
print_warning "TypeScript type checking failed or not configured"
fi
cd ..
# Performance Tests (basic)
echo
print_status "Running Performance Tests..."
echo "============================"
print_status "Testing label creation performance..."
# Could add performance benchmarks here
print_success "Basic performance tests completed"
# Security Tests
echo
print_status "Running Security Tests..."
echo "========================="
print_status "Checking for security vulnerabilities..."
cd frontend
if npm audit --audit-level moderate; then
print_success "No moderate+ security vulnerabilities found"
else
print_warning "Security vulnerabilities detected - review npm audit output"
fi
cd ..
# Final Summary
echo
echo "🎉 Label System Test Suite Complete!"
echo "===================================="
print_success "All critical tests passed"
echo
echo "📊 Test Summary:"
echo " ✅ Backend unit tests"
echo " ✅ Backend integration tests (if Docker available)"
echo " ✅ Frontend component tests"
echo " ✅ Frontend page tests"
echo " ✅ Type checking"
echo " ✅ Security audit"
echo
echo "📁 Generated Reports:"
echo " • Backend coverage: target/coverage/backend/tarpaulin-report.html"
echo " • Frontend coverage: frontend/coverage/"
echo " • Test logs: Available in console output"
echo
print_status "Label system is ready for production! 🚀"
# Optional: Open coverage reports
if command_exists xdg-open && [ -f "target/coverage/backend/tarpaulin-report.html" ]; then
read -p "Open backend coverage report? (y/n): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
xdg-open target/coverage/backend/tarpaulin-report.html
fi
fi

View File

@ -1,20 +0,0 @@
// Simple test file to verify BulkDeleteRequest compilation
use readur::routes::documents::BulkDeleteRequest;
use uuid::Uuid;
fn main() {
// Create a BulkDeleteRequest to test compilation
let request = BulkDeleteRequest {
document_ids: vec![Uuid::new_v4(), Uuid::new_v4()],
};
// Test serialization
let json = serde_json::to_string(&request).unwrap();
println!("JSON: {}", json);
// Test deserialization
let deserialized: BulkDeleteRequest = serde_json::from_str(&json).unwrap();
println!("Deserialized IDs count: {}", deserialized.document_ids.len());
println!("BulkDeleteRequest compilation test passed!");
}