mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-13 01:30:53 +02:00
better namespacing for assertions
This commit is contained in:
@ -15,7 +15,7 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
shell.CreateFile("myfile2", "myfile2 content")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||
assert.CommitCount(0)
|
||||
assert.Model().CommitCount(0)
|
||||
|
||||
input.PrimaryAction()
|
||||
input.NextItem()
|
||||
@ -26,7 +26,7 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
input.CommitMessagePanel().Type(commitMessage).Confirm()
|
||||
|
||||
assert.CommitCount(1)
|
||||
assert.HeadCommitMessage(Equals(commitMessage))
|
||||
assert.Model().CommitCount(1)
|
||||
assert.Model().HeadCommitMessage(Equals(commitMessage))
|
||||
},
|
||||
})
|
||||
|
@ -14,15 +14,15 @@ var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
shell.CreateFile("myfile", "myfile content")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||
assert.CommitCount(0)
|
||||
assert.Model().CommitCount(0)
|
||||
|
||||
input.PrimaryAction()
|
||||
input.Press(keys.Files.CommitChanges)
|
||||
|
||||
input.CommitMessagePanel().Type("first line").AddNewline().AddNewline().Type("third line").Confirm()
|
||||
|
||||
assert.CommitCount(1)
|
||||
assert.HeadCommitMessage(Equals("first line"))
|
||||
assert.Model().CommitCount(1)
|
||||
assert.Model().HeadCommitMessage(Equals("first line"))
|
||||
|
||||
input.SwitchToCommitsView()
|
||||
assert.Views().Main().Content(MatchesRegexp("first line\n\\s*\n\\s*third line"))
|
||||
|
@ -17,7 +17,7 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
EmptyCommit("commit 3")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||
assert.CommitCount(3)
|
||||
assert.Model().CommitCount(3)
|
||||
|
||||
input.SwitchToCommitsView()
|
||||
assert.Views().Current().Lines(
|
||||
@ -32,7 +32,7 @@ var NewBranch = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
branchName := "my-branch-name"
|
||||
input.Prompt().Title(Equals("New Branch Name")).Type(branchName).Confirm()
|
||||
|
||||
assert.CurrentBranchName(branchName)
|
||||
assert.Model().CurrentBranchName(branchName)
|
||||
|
||||
assert.Views().ByName("commits").Lines(
|
||||
Contains("commit 2"),
|
||||
|
@ -16,7 +16,7 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
shell.Commit("first commit")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||
assert.CommitCount(1)
|
||||
assert.Model().CommitCount(1)
|
||||
|
||||
input.SwitchToCommitsView()
|
||||
|
||||
@ -37,6 +37,6 @@ var Revert = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
)
|
||||
|
||||
assert.Views().Main().Content(Contains("-myfile content"))
|
||||
assert.FileSystemPathNotPresent("myfile")
|
||||
assert.FileSystem().PathNotPresent("myfile")
|
||||
},
|
||||
})
|
||||
|
@ -16,7 +16,7 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
CreateFile("myfile2", "myfile2 content")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||
assert.CommitCount(0)
|
||||
assert.Model().CommitCount(0)
|
||||
|
||||
assert.Views().Current().Name("files")
|
||||
assert.Views().Current().SelectedLine(Contains("myfile"))
|
||||
@ -44,9 +44,9 @@ var Staged = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
input.Type(commitMessage)
|
||||
input.Confirm()
|
||||
|
||||
assert.CommitCount(1)
|
||||
assert.HeadCommitMessage(Equals(commitMessage))
|
||||
assert.CurrentWindowName("stagingSecondary")
|
||||
assert.Model().CommitCount(1)
|
||||
assert.Model().HeadCommitMessage(Equals(commitMessage))
|
||||
assert.Views().Current().Name("stagingSecondary")
|
||||
|
||||
// TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed)
|
||||
},
|
||||
|
@ -16,7 +16,7 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
CreateFile("myfile2", "myfile2 content")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||
assert.CommitCount(0)
|
||||
assert.Model().CommitCount(0)
|
||||
|
||||
// stage the file
|
||||
assert.Views().Current().Name("files")
|
||||
@ -44,8 +44,8 @@ var StagedWithoutHooks = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
commitMessage := ": my commit message"
|
||||
input.CommitMessagePanel().InitialText(Contains("WIP")).Type(commitMessage).Confirm()
|
||||
|
||||
assert.CommitCount(1)
|
||||
assert.HeadCommitMessage(Equals("WIP" + commitMessage))
|
||||
assert.Model().CommitCount(1)
|
||||
assert.Model().HeadCommitMessage(Equals("WIP" + commitMessage))
|
||||
assert.Views().Current().Name("stagingSecondary")
|
||||
|
||||
// TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed)
|
||||
|
@ -18,7 +18,7 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
CreateFile("myfile2", "myfile2 content")
|
||||
},
|
||||
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||
assert.CommitCount(0)
|
||||
assert.Model().CommitCount(0)
|
||||
|
||||
assert.Views().Current().Name("files").SelectedLine(Contains("myfile"))
|
||||
input.Enter()
|
||||
@ -34,9 +34,9 @@ var Unstaged = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
commitMessage := "my commit message"
|
||||
input.CommitMessagePanel().Type(commitMessage).Confirm()
|
||||
|
||||
assert.CommitCount(1)
|
||||
assert.HeadCommitMessage(Equals(commitMessage))
|
||||
assert.CurrentWindowName("staging")
|
||||
assert.Model().CommitCount(1)
|
||||
assert.Model().HeadCommitMessage(Equals(commitMessage))
|
||||
assert.Views().Current().Name("staging")
|
||||
|
||||
// TODO: assert that the staging panel has been refreshed (it currently does not get correctly refreshed)
|
||||
},
|
||||
|
Reference in New Issue
Block a user