mirror of
https://github.com/kristoferssolo/traxor.git
synced 2026-02-04 06:42:04 +00:00
feat(config): add config file
This commit is contained in:
23
tests/app.rs
23
tests/app.rs
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user