jammutkarsh / pms

Project Management S̶y̶s̶t̶e̶m̶ Sucks - A CLI tool to manage all your project.
MIT License
6 stars 1 forks source link

Test: Add integration test using VHS #5

Open jammutkarsh opened 11 months ago

jammutkarsh commented 11 months ago

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.

jammutkarsh commented 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.")
}