-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.sh
More file actions
executable file
·91 lines (72 loc) · 3.01 KB
/
run_tests.sh
File metadata and controls
executable file
·91 lines (72 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
# Test script for mystuff-cli
# This script runs all tests in the proper order
set -e
echo "🧪 Running mystuff-cli tests..."
# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Function to run a test and report results
run_test() {
local test_name="$1"
local test_command="$2"
echo -e "${YELLOW}Running $test_name...${NC}"
if eval "$test_command"; then
echo -e "${GREEN}✅ $test_name passed!${NC}"
return 0
else
echo -e "${RED}❌ $test_name failed!${NC}"
return 1
fi
}
# Set up test environment
export MYSTUFF_HOME="/tmp/test_mystuff_script"
rm -rf "$MYSTUFF_HOME"
echo "🏗️ Setting up test environment..."
echo " Test directory: $MYSTUFF_HOME"
# Install package in development mode
echo "📦 Installing package in development mode..."
pip install -e .
# Run unit tests
echo -e "\n🔧 Running unit tests..."
run_test "Init tests" "python tests/test_init_simple.py"
run_test "Link tests" "python tests/test_link.py"
run_test "Meeting tests" "python tests/test_meeting.py"
run_test "Journal tests" "python tests/test_journal_simple.py"
run_test "Wiki tests" "python tests/test_wiki_simple.py"
run_test "Eval tests" "python tests/test_eval_simple.py"
run_test "Lists tests" "python tests/test_lists_simple.py"
run_test "GitHub stars tests" "python tests/test_github_stars.py"
run_test "Error handling tests" "python tests/test_error_handling.py"
run_test "fzf integration tests" "python tests/test_fzf_integration.py"
# Run integration tests
echo -e "\n🔗 Running integration tests..."
run_test "CLI version" "mystuff --version"
run_test "CLI help" "mystuff --help >/dev/null"
run_test "CLI init" "mystuff init --force"
# Test basic functionality
echo -e "\n⚙️ Testing basic functionality..."
run_test "Add link" "mystuff link add --url 'https://github.com' --title 'GitHub'"
run_test "List links" "mystuff link list"
run_test "Search links" "mystuff link search 'GitHub'"
run_test "Add meeting" "mystuff meeting add --title 'Test Meeting' --date '2023-12-01' --no-edit"
run_test "List meetings" "mystuff meeting list"
run_test "Search meetings" "mystuff meeting search 'Test'"
run_test "Add journal" "mystuff journal add --date '2023-12-01' --body 'Test journal entry' --no-edit"
run_test "List journals" "mystuff journal list --no-interactive"
run_test "Search journals" "mystuff journal search 'Test' --no-interactive"
run_test "Add wiki" "mystuff wiki new 'Test Wiki Note' --tag 'test' --body 'Test wiki content' --no-edit"
run_test "List wikis" "mystuff wiki list --no-interactive"
run_test "Search wikis" "mystuff wiki search 'Test' --no-interactive"
# Check if fzf is available
if command -v fzf &> /dev/null; then
echo -e "\n🔍 fzf is available - interactive features enabled"
else
echo -e "\n⚠️ fzf not available - interactive features disabled"
fi
# Clean up
echo -e "\n🧹 Cleaning up test environment..."
rm -rf "$MYSTUFF_HOME"
echo -e "\n${GREEN}🎉 All tests completed successfully!${NC}"