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")
|
pathToDir := th.App.createDirForEmoji("test.json", "exported_emoji_test")
|
||||||
defer os.Remove(pathToDir)
|
defer os.Remove(pathToDir)
|
||||||
if _, err := os.Stat(pathToDir); os.IsNotExist(err) {
|
_, err := os.Stat(pathToDir)
|
||||||
t.Fatal("Directory exported_emoji_test should exist")
|
require.False(t, os.IsNotExist(err), "Directory exported_emoji_test should exist")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCopyEmojiImages(t *testing.T) {
|
func TestCopyEmojiImages(t *testing.T) {
|
||||||
@@ -147,13 +146,10 @@ func TestCopyEmojiImages(t *testing.T) {
|
|||||||
defer os.RemoveAll(filePath)
|
defer os.RemoveAll(filePath)
|
||||||
|
|
||||||
copyError := th.App.copyEmojiImages(emoji.Id, emojiImagePath, pathToDir)
|
copyError := th.App.copyEmojiImages(emoji.Id, emojiImagePath, pathToDir)
|
||||||
if copyError != nil {
|
require.Nil(t, copyError)
|
||||||
t.Fatal(copyError)
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := os.Stat(pathToDir + "/" + emoji.Id + "/image"); os.IsNotExist(err) {
|
_, err = os.Stat(pathToDir + "/" + emoji.Id + "/image")
|
||||||
t.Fatal("File should exist ", err)
|
require.False(t, os.IsNotExist(err), "File should exist ")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExportCustomEmoji(t *testing.T) {
|
func TestExportCustomEmoji(t *testing.T) {
|
||||||
@@ -170,9 +166,8 @@ func TestExportCustomEmoji(t *testing.T) {
|
|||||||
dirNameToExportEmoji := "exported_emoji_test"
|
dirNameToExportEmoji := "exported_emoji_test"
|
||||||
defer os.RemoveAll("../" + dirNameToExportEmoji)
|
defer os.RemoveAll("../" + dirNameToExportEmoji)
|
||||||
|
|
||||||
if err := th.App.ExportCustomEmoji(fileWriter, filePath, pathToEmojiDir, dirNameToExportEmoji); err != nil {
|
err = th.App.ExportCustomEmoji(fileWriter, filePath, pathToEmojiDir, dirNameToExportEmoji)
|
||||||
t.Fatal(err)
|
require.Nil(t, err, "should not have failed")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExportAllUsers(t *testing.T) {
|
func TestExportAllUsers(t *testing.T) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user