Skip to content

Commit

Permalink
align FILE_TEMPLATE with default format of obsidian
Browse files Browse the repository at this point in the history
  • Loading branch information
skatkov committed Sep 20, 2023
1 parent 3eda93a commit 02960c6
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion internal/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"
)

const FILE_TEMPLATE = "2006-Jan-02"
const FILE_TEMPLATE = "2006-01-02"

type Entry interface {
Filepath() string
Expand Down
6 changes: 3 additions & 3 deletions internal/entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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())
}
File renamed without changes.

0 comments on commit 02960c6

Please sign in to comment.