1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

cleaner test assertions

This commit is contained in:
Jesse Duffield
2022-12-26 11:12:56 +11:00
parent fa0414777f
commit 9a6f21ce42
34 changed files with 442 additions and 378 deletions

View File

@ -30,7 +30,9 @@ var Basic = NewIntegrationTest(NewIntegrationTestArgs{
assert.WorkingTreeFileCount(0)
input.Press("a")
assert.WorkingTreeFileCount(1)
assert.CurrentLine(Contains("myfile"))
assert.View("files").Lines(
Contains("myfile"),
)
},
})

View File

@ -72,7 +72,7 @@ var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{
input.AcceptConfirmation(Equals("Are you sure?"), Equals("Are you REALLY sure you want to make this file? Up to you buddy."))
assert.WorkingTreeFileCount(1)
assert.CurrentLine(Contains("my file"))
assert.MainViewContent(Contains(`"BAR"`))
assert.CurrentView().SelectedLine(Contains("my file"))
assert.MainView().Content(Contains(`"BAR"`))
},
})

View File

@ -60,7 +60,7 @@ var MenuFromCommand = NewIntegrationTest(NewIntegrationTestArgs{
input.SwitchToFilesWindow()
assert.WorkingTreeFileCount(1)
assert.CurrentLine(Contains("output.txt"))
assert.MainViewContent(Contains("bar Branch: #feature/foo my branch feature/foo"))
assert.CurrentView().SelectedLine(Contains("output.txt"))
assert.MainView().Content(Contains("bar Branch: #feature/foo my branch feature/foo"))
},
})

View File

@ -55,8 +55,9 @@ var MenuFromCommandsOutput = NewIntegrationTest(NewIntegrationTestArgs{
input.Press("a")
assert.InPrompt()
assert.CurrentViewTitle(Equals("Which git command do you want to run?"))
assert.CurrentLine(Equals("branch"))
assert.CurrentView().
Title(Equals("Which git command do you want to run?")).
SelectedLine(Equals("branch"))
input.Confirm()
input.Menu(Equals("Branch:"), Equals("master"))

View File

@ -70,7 +70,7 @@ var MultiplePrompts = NewIntegrationTest(NewIntegrationTestArgs{
input.AcceptConfirmation(Equals("Are you sure?"), Equals("Are you REALLY sure you want to make this file? Up to you buddy."))
assert.WorkingTreeFileCount(1)
assert.CurrentLine(Contains("myfile"))
assert.MainViewContent(Contains("BAR"))
assert.CurrentView().SelectedLine(Contains("myfile"))
assert.MainView().Content(Contains("BAR"))
},
})