test: new changes related to filesystem.CreateDirectory

This commit is contained in:
HFO4
2022-04-21 14:29:10 +08:00
parent 2ab2662fcd
commit aaf8a793ee
4 changed files with 115 additions and 24 deletions

View File

@@ -147,6 +147,7 @@ func TestImportTask_Do(t *testing.T) {
mock.ExpectQuery("SELECT(.+)folders").WillReturnRows(sqlmock.NewRows([]string{"id"}))
// 创建文件时查找父目录,仍然不存在
mock.ExpectQuery("SELECT(.+)folders").WillReturnRows(sqlmock.NewRows([]string{"id"}))
mock.ExpectQuery("SELECT(.+)folders").WillReturnRows(sqlmock.NewRows([]string{"id"}))
task.Do()
@@ -177,6 +178,7 @@ func TestImportTask_Do(t *testing.T) {
mock.ExpectQuery("SELECT(.+)files").WillReturnRows(sqlmock.NewRows([]string{"id"}))
// 创建目录
mock.ExpectBegin()
mock.ExpectQuery("SELECT(.+)folders").WillReturnRows(sqlmock.NewRows([]string{"id"}))
mock.ExpectExec("INSERT(.+)folders(.+)").WillReturnResult(sqlmock.NewResult(2, 1))
mock.ExpectCommit()
// 插入文件记录