Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
waynezhang committed Jan 5, 2024
1 parent 4aef34c commit 1827f6c
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions internal/export/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,38 +221,6 @@ func TestGenerateIndexHTML(t *testing.T) {
mockMinimizer.AssertCalled(t, "MinimizeFile", mock.Anything, mock.Anything)
}

func TestProcessOtherFolders(t *testing.T) {
tmp, _ := prepareTempDirAndCache(t)
defer os.RemoveAll(tmp)

mockMinimizer := new(MockMinimizer)
mockMinimizer.On("Minimizable", mock.Anything).Return(true)
mockMinimizer.On("MinimizeFile", mock.Anything, mock.Anything).Return(nil)

mockFunc := new(MockFunc)
mockFunc.On("messageFunc", mock.Anything, mock.Anything).Return(nil)
messageFunc := func(src string, dst string) {
mockFunc.messageFunc(src, dst)
}

collection1Folder := testdata.Collection1["folder"].(string)
collection2Folder := testdata.Collection2["folder"].(string)
new(defaultExportContext).processOtherFolders([]string{
collection1Folder,
collection2Folder,
}, tmp, mockMinimizer, messageFunc)

file1 := filepath.Join(tmp, collection1Folder, testdata.Collection1FileName1)
file2 := filepath.Join(tmp, collection2Folder, testdata.Collection2FileName1)
assert.True(t, true, files.IsExisting(file1))
assert.True(t, true, files.IsExisting(file2))

mockFunc.AssertNumberOfCalls(t, "messageFunc", 2) // 2 folders

mockMinimizer.AssertCalled(t, "Minimizable", mock.Anything)
mockMinimizer.AssertCalled(t, "MinimizeFile", mock.Anything, mock.Anything)
}

func TestResizeImageCache(t *testing.T) {
tmp, _ := os.MkdirTemp("", "foto-test")
defer os.RemoveAll(tmp)
Expand Down

0 comments on commit 1827f6c

Please sign in to comment.