mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-13 11:50:28 +02:00
39 lines
997 B
Go
39 lines
997 B
Go
package components
|
|
|
|
import (
|
|
integrationTypes "github.com/jesseduffield/lazygit/pkg/integration/types"
|
|
)
|
|
|
|
// through this struct we assert on the state of the lazygit gui
|
|
|
|
type Assert struct {
|
|
input *Input
|
|
gui integrationTypes.GuiDriver
|
|
*assertionHelper
|
|
}
|
|
|
|
func NewAssert(gui integrationTypes.GuiDriver) *Assert {
|
|
return &Assert{gui: gui}
|
|
}
|
|
|
|
// for making assertions on lazygit views
|
|
func (self *Assert) Views() *Views {
|
|
return &Views{assert: self, input: self.input}
|
|
}
|
|
|
|
// for making assertions on the lazygit model
|
|
func (self *Assert) Model() *Model {
|
|
return &Model{assertionHelper: self.assertionHelper, gui: self.gui}
|
|
}
|
|
|
|
// for making assertions on the file system
|
|
func (self *Assert) FileSystem() *FileSystem {
|
|
return &FileSystem{assertionHelper: self.assertionHelper}
|
|
}
|
|
|
|
// for when you just want to fail the test yourself.
|
|
// This runs callbacks to ensure we render the error after closing the gui.
|
|
func (self *Assert) Fail(message string) {
|
|
self.assertionHelper.fail(message)
|
|
}
|