Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tests/search_fzf.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
use std::fs;
use wkey::model::{Item, Note, Shortcut};

fn should_skip_on_github_actions() -> bool {
std::env::var_os("GITHUB_ACTIONS").is_some()
}

#[test]
fn search_items_returns_selected_item_key_from_fzf_output() {
if should_skip_on_github_actions() {
return;
}

let temp = tempfile::tempdir().unwrap();
let fake_fzf = temp.path().join("fake-fzf");
fs::write(
Expand Down Expand Up @@ -30,6 +38,10 @@ fn search_items_returns_selected_item_key_from_fzf_output() {

#[test]
fn search_items_invokes_fzf_with_top_aligned_layout() {
if should_skip_on_github_actions() {
return;
}

let temp = tempfile::tempdir().unwrap();
let fake_fzf = temp.path().join("fake-fzf");
let args_file = temp.path().join("args.txt");
Expand Down Expand Up @@ -63,6 +75,10 @@ fn search_items_invokes_fzf_with_top_aligned_layout() {

#[test]
fn search_items_with_fallback_does_not_invoke_fallback_on_cancel() {
if should_skip_on_github_actions() {
return;
}

let temp = tempfile::tempdir().unwrap();
let fake_fzf = temp.path().join("fake-fzf");
fs::write(&fake_fzf, "#!/bin/sh\nexit 130\n").unwrap();
Expand Down
12 changes: 12 additions & 0 deletions tests/search_only_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ fn shell_quote(value: &str) -> String {
format!("'{}'", value.replace('\'', "'\\''"))
}

fn should_skip_on_github_actions() -> bool {
std::env::var_os("GITHUB_ACTIONS").is_some()
}

#[test]
fn search_only_prints_selected_item_desc_without_opening_main_tui() {
if should_skip_on_github_actions() {
return;
}

let temp = tempfile::tempdir().unwrap();
let config_dir = temp.path().join("config");
let fake_bin_dir = temp.path().join("bin");
Expand Down Expand Up @@ -61,6 +69,10 @@ tip = { desc = "Remember this" }

#[test]
fn search_only_also_pipes_selected_desc_to_pipeout_command() {
if should_skip_on_github_actions() {
return;
}

let temp = tempfile::tempdir().unwrap();
let config_dir = temp.path().join("config");
let fake_bin_dir = temp.path().join("bin");
Expand Down
Loading