From 02960c60fa6e7da9785bf8a38e9d4015308f4e51 Mon Sep 17 00:00:00 2001 From: Stanislav Katkov Date: Wed, 20 Sep 2023 11:17:36 +0200 Subject: [PATCH] align FILE_TEMPLATE with default format of obsidian --- internal/context_test.go | 4 ++-- internal/entry.go | 2 +- internal/entry_test.go | 6 +++--- .../journal_with_entry/{2022-jan-01.md => 2022-01-01.md} | 0 .../{2022-just-name.txt => 2022-just-name.md} | 0 .../{1984-jan-25.md => 1984-01-25.md} | 0 6 files changed, 6 insertions(+), 6 deletions(-) rename test/data/journal_with_entry/{2022-jan-01.md => 2022-01-01.md} (100%) rename test/data/journal_with_entry/{2022-just-name.txt => 2022-just-name.md} (100%) rename test/data/journal_with_various_entries/{1984-jan-25.md => 1984-01-25.md} (100%) diff --git a/internal/context_test.go b/internal/context_test.go index 6bfee6c..c49883e 100644 --- a/internal/context_test.go +++ b/internal/context_test.go @@ -14,13 +14,13 @@ func TestFiles(t *testing.T) { test_folder := strings.TrimSuffix(current_dir, "/internal") + "/test/data" ctx := NewContext(test_folder+"/journal_with_entry", "", "", "") - assert.Equal(t, []string{test_folder + "/journal_with_entry/" + "2022-jan-01.md"}, ctx.Files()) + assert.Equal(t, []string{test_folder + "/journal_with_entry/" + "2022-01-01.md"}, ctx.Files()) ctx = NewContext(test_folder+"/journal_with_entry", "txt", "", "") assert.Empty(t, ctx.Files()) ctx = NewContext(test_folder+"/journal_with_various_entries", "md", "", "") - assert.Equal(t, []string{test_folder + "/journal_with_various_entries/" + "1984-jan-25.md"}, ctx.Files()) + assert.Equal(t, []string{test_folder + "/journal_with_various_entries/" + "1984-01-25.md"}, ctx.Files()) ctx = NewContext(test_folder+"/journal_zero", "", "", "") assert.Empty(t, ctx.Files()) diff --git a/internal/entry.go b/internal/entry.go index 4255bb9..b567c35 100644 --- a/internal/entry.go +++ b/internal/entry.go @@ -6,7 +6,7 @@ import ( "time" ) -const FILE_TEMPLATE = "2006-Jan-02" +const FILE_TEMPLATE = "2006-01-02" type Entry interface { Filepath() string diff --git a/internal/entry_test.go b/internal/entry_test.go index 4a6c0f4..7f10aab 100644 --- a/internal/entry_test.go +++ b/internal/entry_test.go @@ -15,7 +15,7 @@ func TestNewEntry(t *testing.T) { homeDir, _ := user.Current() - assert.Equal(t, homeDir.HomeDir+"/Journal/2020-jan-01.md", e.Filepath()) + assert.Equal(t, homeDir.HomeDir+"/Journal/2020-01-01.md", e.Filepath()) } func TestNewEntryWithExtension(t *testing.T) { @@ -25,7 +25,7 @@ func TestNewEntryWithExtension(t *testing.T) { homeDir, _ := user.Current() - assert.Equal(t, homeDir.HomeDir+"/Journal/2020-jan-01.txt", e.Filepath()) + assert.Equal(t, homeDir.HomeDir+"/Journal/2020-01-01.txt", e.Filepath()) } func TestNewEntryWithDirectory(t *testing.T) { @@ -35,5 +35,5 @@ func TestNewEntryWithDirectory(t *testing.T) { homeDir, _ := user.Current() - assert.Equal(t, homeDir.HomeDir+"/Journal/test/2020-jan-01.md", e.Filepath()) + assert.Equal(t, homeDir.HomeDir+"/Journal/test/2020-01-01.md", e.Filepath()) } diff --git a/test/data/journal_with_entry/2022-jan-01.md b/test/data/journal_with_entry/2022-01-01.md similarity index 100% rename from test/data/journal_with_entry/2022-jan-01.md rename to test/data/journal_with_entry/2022-01-01.md diff --git a/test/data/journal_with_entry/2022-just-name.txt b/test/data/journal_with_entry/2022-just-name.md similarity index 100% rename from test/data/journal_with_entry/2022-just-name.txt rename to test/data/journal_with_entry/2022-just-name.md diff --git a/test/data/journal_with_various_entries/1984-jan-25.md b/test/data/journal_with_various_entries/1984-01-25.md similarity index 100% rename from test/data/journal_with_various_entries/1984-jan-25.md rename to test/data/journal_with_various_entries/1984-01-25.md