Skip to content

Commit

Permalink
Minor clean up (#130)
Browse files Browse the repository at this point in the history
* small test

* more tests

* readme.md update

---------

Co-authored-by: Maksym Bilan <>
  • Loading branch information
maximbilan authored Dec 29, 2024
1 parent 9804639 commit c243753
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# capymind

[![Building](https://github.com/maximbilan/capymind/actions/workflows/build_and_test.yml/badge.svg)](https://github.com/maximbilan/capymind/actions/workflows/build_and_test.yml)
![Coverage](./.badges/test_coverage.svg)
[![CI](https://github.com/maximbilan/capymind/actions/workflows/build_and_test.yml/badge.svg)](https://github.com/maximbilan/capymind/actions/workflows/build_and_test.yml)
![Test coverage](./.badges/test_coverage.svg)

CapyMind is a personal mental health journal designed to help you track your thoughts, emotions, and progress over time. By offering a simple and secure platform to make journal entries, set reminders, and receive personalized therapy insights, CapyMind empowers you to reflect on your mental well-being. With support for multiple languages and time zones, it fits seamlessly into your daily routine, providing a personalized space for self-reflection and growth.

Expand Down
30 changes: 30 additions & 0 deletions internal/translator/translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,33 @@ func TestFormattedTexts(t *testing.T) {
t.Errorf("Translate() = %v, want %v", got, want)
}
}

func TestPromptMethod(t *testing.T) {
locale1 := Locale("en")
locale2 := Locale("uk")

want := "Below is a list of my recent journal entries. Please provide feedback: "
if got := Prompt(locale1, "ai_weekly_analysis_user_message"); got != want {
t.Errorf("Prompt() = %v, want %v", got, want)
}

want = "Нижче наведено список моїх нещодавніх записів у журналі. Будь ласка, надайте відгук. Записи: "
if got := Prompt(locale2, "ai_weekly_analysis_user_message"); got != want {
t.Errorf("Prompt() = %v, want %v", got, want)
}
}

func TestSearchKeywordsMethod(t *testing.T) {
locale1 := Locale("en")
locale2 := Locale("uk")

want := []string{"dream", "dreams", "night", "sleep", "dreaming", "nightmare"}
if got := SearchKeywords(locale1, "dreams"); len(got) != len(want) {
t.Errorf("SearchKeywords() = %v, want %v", got, want)
}

want = []string{"сни", "сон", "сновидіння", "кошмари", "кошмар", "cні", "приснилось", "приснилося", "наснилось", "наснилося", "сниться", "снів", "снах", "снилось", "снилося", "сновидінь", "сновидіннях"}
if got := SearchKeywords(locale2, "dreams"); len(got) != len(want) {
t.Errorf("SearchKeywords() = %v, want %v", got, want)
}
}
12 changes: 12 additions & 0 deletions internal/utils/timezone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,15 @@ func TestTimeZones(t *testing.T) {
t.Fatalf("Expected -7, got %s", list[5].Parameter())
}
}

func TestStr(t *testing.T) {
info := TimeZoneInfo{
Offset: 1,
Description: "GMT +1",
SecondsFromUTC: 3600,
}

if info.Parameter() != "3600" {
t.Fatalf("Expected 3600, got %s", info.Parameter())
}
}

0 comments on commit c243753

Please sign in to comment.