Open jammutkarsh opened 11 months ago
Update: another way of testing suggested by Christian Rocha
So Bubble Tea is actually pretty mechanical and for a lot of things you can just simulate events passing through the model in a very manual fashion, i.e.:
m := NewModel()
m, _ = m.Update(tea.KeyMsg{Type: tea.KeyEnter})
if m.state != coolState {
t.Error("We thought things were going to be cool, but they were not!")
}
Commands can work this way as well:
m := NewModel()
cmd := m.Init()
m, cmd, = m.Update(cmd())
if m.state != coolState {
t.Error("The model is very, very uncool right now.")
}
Since there are no core functions that process data, there are no uni tests that could be written in this application. But as a whole this application could have an integration test as demonstrated in Charm's youtube video
Research more on this and add context.