Convert app/export_test.go t.Fatal calls into assert/require calls (#12184)
Этот коммит содержится в:
коммит произвёл
Miguel de la Cruz
родитель
738a948e45
Коммит
995a545411
@@ -115,9 +115,8 @@ func TestDirCreationForEmoji(t *testing.T) {
|
||||
|
||||
pathToDir := th.App.createDirForEmoji("test.json", "exported_emoji_test")
|
||||
defer os.Remove(pathToDir)
|
||||
if _, err := os.Stat(pathToDir); os.IsNotExist(err) {
|
||||
t.Fatal("Directory exported_emoji_test should exist")
|
||||
}
|
||||
_, err := os.Stat(pathToDir)
|
||||
require.False(t, os.IsNotExist(err), "Directory exported_emoji_test should exist")
|
||||
}
|
||||
|
||||
func TestCopyEmojiImages(t *testing.T) {
|
||||
@@ -147,13 +146,10 @@ func TestCopyEmojiImages(t *testing.T) {
|
||||
defer os.RemoveAll(filePath)
|
||||
|
||||
copyError := th.App.copyEmojiImages(emoji.Id, emojiImagePath, pathToDir)
|
||||
if copyError != nil {
|
||||
t.Fatal(copyError)
|
||||
}
|
||||
require.Nil(t, copyError)
|
||||
|
||||
if _, err := os.Stat(pathToDir + "/" + emoji.Id + "/image"); os.IsNotExist(err) {
|
||||
t.Fatal("File should exist ", err)
|
||||
}
|
||||
_, err = os.Stat(pathToDir + "/" + emoji.Id + "/image")
|
||||
require.False(t, os.IsNotExist(err), "File should exist ")
|
||||
}
|
||||
|
||||
func TestExportCustomEmoji(t *testing.T) {
|
||||
@@ -170,9 +166,8 @@ func TestExportCustomEmoji(t *testing.T) {
|
||||
dirNameToExportEmoji := "exported_emoji_test"
|
||||
defer os.RemoveAll("../" + dirNameToExportEmoji)
|
||||
|
||||
if err := th.App.ExportCustomEmoji(fileWriter, filePath, pathToEmojiDir, dirNameToExportEmoji); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
err = th.App.ExportCustomEmoji(fileWriter, filePath, pathToEmojiDir, dirNameToExportEmoji)
|
||||
require.Nil(t, err, "should not have failed")
|
||||
}
|
||||
|
||||
func TestExportAllUsers(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user