mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-03 00:57:52 +02:00
Cleanup: simplify and tighten test expectations related to clipboard
Change our fake clipboard command to not append a linefeed; that's closer to what the production code does. This allows us to use Equals instead of Contains for checking the clipboard contents. Finally, use FileSystem().FileContent() to assert the clipboard contents, instead of selecting the clipboard file and then checking the diff view.
This commit is contained in:
@ -12,8 +12,7 @@ var CopyAuthorToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
// Include delimiters around the text so that we can assert on the entire content
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "echo /{{text}}/ > clipboard"
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard"
|
||||
},
|
||||
|
||||
SetupRepo: func(shell *Shell) {
|
||||
@ -36,13 +35,6 @@ var CopyAuthorToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
t.ExpectToast(Equals("Commit author copied to clipboard"))
|
||||
|
||||
t.Views().Files().
|
||||
Focus().
|
||||
Press(keys.Files.RefreshFiles).
|
||||
Lines(
|
||||
Contains("clipboard").IsSelected(),
|
||||
)
|
||||
|
||||
t.Views().Main().Content(Contains("/John Doe <john@doe.com>/"))
|
||||
t.FileSystem().FileContent("clipboard", Equals("John Doe <john@doe.com>"))
|
||||
},
|
||||
})
|
||||
|
Reference in New Issue
Block a user