mirror of
https://github.com/Xevion/banner.git
synced 2025-12-05 23:14:20 -06:00
Switch to Bun for 2-5x faster frontend builds, implement cargo-chef for reliable Rust dependency caching, and add Biome for fast code formatting. Build system improvements: - Replace pnpm with Bun for frontend package management - Add cargo-chef to Dockerfile for better Rust build layer caching - Update all commands to use bun instead of pnpm Developer experience: - Add comprehensive Justfile commands (format, format-check, db) - Implement automated PostgreSQL Docker setup with random port allocation - Add stricter checks (--deny warnings on clippy, --all-features flag) Code quality: - Add Biome formatter for 10-100x faster TypeScript/JavaScript formatting - Add GitHub Actions CI/CD workflow for automated checks - Update .dockerignore with comprehensive exclusions - Format all code with cargo fmt (Rust) and Biome (TypeScript) All changes maintain backward compatibility and can be tested incrementally.
40 lines
1.4 KiB
Rust
40 lines
1.4 KiB
Rust
use banner::utils::shutdown::join_tasks;
|
|
use tokio::task::JoinHandle;
|
|
|
|
#[tokio::test]
|
|
async fn test_join_tasks_success() {
|
|
// Create some tasks that complete successfully
|
|
let handles: Vec<JoinHandle<()>> = vec![
|
|
tokio::spawn(async { tokio::time::sleep(tokio::time::Duration::from_millis(10)).await }),
|
|
tokio::spawn(async { tokio::time::sleep(tokio::time::Duration::from_millis(20)).await }),
|
|
tokio::spawn(async { /* immediate completion */ }),
|
|
];
|
|
|
|
// All tasks should complete successfully
|
|
let result = join_tasks(handles).await;
|
|
assert!(
|
|
result.is_ok(),
|
|
"Expected all tasks to complete successfully"
|
|
);
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn test_join_tasks_with_panic() {
|
|
// Create some tasks, including one that panics
|
|
let handles: Vec<JoinHandle<()>> = vec![
|
|
tokio::spawn(async { tokio::time::sleep(tokio::time::Duration::from_millis(10)).await }),
|
|
tokio::spawn(async { panic!("intentional test panic") }),
|
|
tokio::spawn(async { /* immediate completion */ }),
|
|
];
|
|
|
|
// Should return an error because one task panicked
|
|
let result = join_tasks(handles).await;
|
|
assert!(result.is_err(), "Expected an error when a task panics");
|
|
|
|
let error_msg = result.unwrap_err().to_string();
|
|
assert!(
|
|
error_msg.contains("1 task(s) panicked"),
|
|
"Error message should mention panicked tasks"
|
|
);
|
|
}
|