feat(config): add config file

This commit is contained in:
2025-07-07 19:18:18 +03:00
parent f393ae8a70
commit 06fa7c003d
20 changed files with 562 additions and 146 deletions

View File

@@ -1,21 +1,24 @@
use traxor::app::App;
use traxor::{app::App, config::Config};
#[test]
fn test_app_creation() {
let app = App::new().unwrap();
let config = Config::load().unwrap();
let app = App::new(config).unwrap();
assert_eq!(app.tabs().len(), 3);
}
#[test]
fn test_app_quit() {
let mut app = App::new().unwrap();
let config = Config::load().unwrap();
let mut app = App::new(config).unwrap();
app.quit();
assert!(!app.running);
}
#[test]
fn test_app_next_tab() {
let mut app = App::new().unwrap();
let config = Config::load().unwrap();
let mut app = App::new(config).unwrap();
assert_eq!(app.index(), 0);
app.next_tab();
assert_eq!(app.index(), 1);
@@ -27,7 +30,8 @@ fn test_app_next_tab() {
#[test]
fn test_app_prev_tab() {
let mut app = App::new().unwrap();
let config = Config::load().unwrap();
let mut app = App::new(config).unwrap();
assert_eq!(app.index(), 0);
app.prev_tab();
assert_eq!(app.index(), 2); // Wraps around
@@ -37,7 +41,8 @@ fn test_app_prev_tab() {
#[test]
fn test_app_switch_tab() {
let mut app = App::new().unwrap();
let config = Config::load().unwrap();
let mut app = App::new(config).unwrap();
assert_eq!(app.index(), 0);
app.switch_tab(2);
assert_eq!(app.index(), 2);
@@ -47,7 +52,8 @@ fn test_app_switch_tab() {
#[test]
fn test_app_toggle_popup() {
let mut app = App::new().unwrap();
let config = Config::load().unwrap();
let mut app = App::new(config).unwrap();
assert!(!app.show_help);
app.toggle_help();
assert!(app.show_help);
@@ -57,7 +63,8 @@ fn test_app_toggle_popup() {
#[test]
fn test_app_open_close_popup() {
let mut app = App::new().unwrap();
let config = Config::load().unwrap();
let mut app = App::new(config).unwrap();
assert!(!app.show_help);
app.open_help();
assert!(app.show_help);