test(thumb): new changes in filesystem pkg

This commit is contained in:
Aaron Liu
2023-04-13 19:39:12 +08:00
parent 408733a974
commit 8e2fc1a8f6
10 changed files with 195 additions and 212 deletions

View File

@@ -58,7 +58,6 @@ func TestFileSystem_AddFile(t *testing.T) {
asserts.NoError(err)
asserts.NoError(mock.ExpectationsWereMet())
asserts.Equal("/Uploads/1_sad.png", f.SourceName)
asserts.NotEmpty(f.PicInfo)
// 前置钩子执行失败
{
@@ -312,6 +311,19 @@ func TestFileSystem_deleteGroupedFile(t *testing.T) {
_, ok := cache.Get(UploadSessionCachePrefix + sessionID)
asserts.False(ok)
}
// 包含缩略图
{
files[0].MetadataSerialized = map[string]string{
model.ThumbSidecarMetadataKey: "1",
}
failed := fs.deleteGroupedFile(ctx, fs.GroupFileByPolicy(ctx, files))
asserts.Equal(map[uint][]string{
1: {},
2: {},
3: {},
}, failed)
}
}
func TestFileSystem_GetSource(t *testing.T) {