mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-25 12:24:47 +02:00
Assert the entire lines using Equals instead of Contains. This makes the tests a bit easier to read, and it makes it much easier to decide how they need to be changed when we change the layout (like we do in the last commit of this branch). It is true that this requires changing all these tests for any future UI changes, but I think this is a good price to pay; those adaptions are trivial and can be done without thinking.
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
package file
|
|
|
|
import (
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
)
|
|
|
|
var RenameSimilarityThresholdChange = NewIntegrationTest(NewIntegrationTestArgs{
|
|
Description: "Change the rename similarity threshold while in the files panel",
|
|
ExtraCmdArgs: []string{},
|
|
Skip: false,
|
|
SetupConfig: func(config *config.AppConfig) {},
|
|
SetupRepo: func(shell *Shell) {
|
|
shell.CreateFileAndAdd("original", "one\ntwo\nthree\nfour\nfive\n")
|
|
shell.Commit("add original")
|
|
|
|
shell.DeleteFileAndAdd("original")
|
|
shell.CreateFileAndAdd("renamed", "one\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten\n")
|
|
},
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
t.Views().Files().
|
|
IsFocused().
|
|
Lines(
|
|
Equals("D original"),
|
|
Equals("A renamed"),
|
|
).
|
|
Press(keys.Universal.DecreaseRenameSimilarityThreshold).
|
|
Tap(func() {
|
|
t.ExpectToast(Equals("Changed rename similarity threshold to 45%"))
|
|
}).
|
|
Lines(
|
|
Equals("R original → renamed"),
|
|
)
|
|
},
|
|
})
|