mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03: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:
@ -17,7 +17,7 @@ var CopyMenu = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "echo {{text}} > clipboard"
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard"
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
@ -100,7 +100,7 @@ var CopyMenu = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
t.ExpectToast(Equals("File name copied to clipboard"))
|
||||
|
||||
expectClipboard(t, Contains("unstaged_file"))
|
||||
expectClipboard(t, Equals("1-unstaged_file"))
|
||||
})
|
||||
|
||||
// Copy file path
|
||||
@ -114,7 +114,7 @@ var CopyMenu = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
t.ExpectToast(Equals("File path copied to clipboard"))
|
||||
|
||||
expectClipboard(t, Contains("dir/1-unstaged_file"))
|
||||
expectClipboard(t, Equals("dir/1-unstaged_file"))
|
||||
})
|
||||
|
||||
// Selected path diff on a single (unstaged) file
|
||||
|
Reference in New Issue
Block a user