From d78262971ff750731701a5ff0ce061e8b231623b Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Sat, 29 Jun 2024 23:48:12 +0200 Subject: [PATCH 1/4] feat: HintView --- internal/view/DESIGN.md | 20 ++--- internal/view/components/hintview/hintview.go | 78 +++++++++++++++++++ internal/view/components/voteview/voteview.go | 8 +- internal/view/model.go | 15 +++- internal/view/render.go | 6 +- 5 files changed, 110 insertions(+), 17 deletions(-) create mode 100644 internal/view/components/hintview/hintview.go diff --git a/internal/view/DESIGN.md b/internal/view/DESIGN.md index 2071fdb..ee18cdb 100644 --- a/internal/view/DESIGN.md +++ b/internal/view/DESIGN.md @@ -6,18 +6,18 @@ package view ```shell - Room: 238mvM91TbC9UJdUqKwtWFb + ● Waku: 8 peer(s) + Room: W1Rka5Dz8GVGzgy1iq6gS5puS1x3JroeW4ZDTfBZkCfm (dealer) + + Issue: https://github.com/golang/go/issues/19412 + proposal: spec: add sum types / discriminated unions + [LanguageChange] [v2] [Proposal] [NeedsInvestigation] - Issue: https://github.com/golang/go/issues/19412 - Title: Implement room encryption - ╭───────┬─────┬─────────┬────────┬─────────╮ - │ Alice │ Bob │ Charlie │ Didukh │ Sirotin │ - ├───────┼─────┼─────────┼────────┼─────────┤ - │ 1 │ 3 │ 8 │ 13 │ 3 │ - ╰───────┴─────┴─────────┴────────┴─────────╯ - - Your vote: + │ Alice │ Bob │ Charlie │ Didukh │ Sirotin │ Recommended: 3 + ├───────┼─────┼─────────┼────────┼─────────┤ Acceptable: x - too big votes variety + │ 1 │ 3 │ 8 │ 13 │ 3 │ What to do: Listen to Alice and Didukh arguments + ╰───────┴─────┴─────────┴────────┴─────────╯ ╭───╮ ╭───╮ ╭───╮ │ 3 │ ╭───╮ ╭───╮ ╭────╮ ╭────╮ ╭────╮ │ 1 │ │ 2 │ ╰───╯ │ 5 │ │ 8 │ │ 13 │ │ 21 │ │ 34 │ diff --git a/internal/view/components/hintview/hintview.go b/internal/view/components/hintview/hintview.go new file mode 100644 index 0000000..3df28d8 --- /dev/null +++ b/internal/view/components/hintview/hintview.go @@ -0,0 +1,78 @@ +package hintview + +import ( + "fmt" + + tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/lipgloss" + + "github.com/six78/2-story-points-cli/internal/config" + "github.com/six78/2-story-points-cli/internal/view/components/voteview" + "github.com/six78/2-story-points-cli/internal/view/messages" + "github.com/six78/2-story-points-cli/pkg/protocol" +) + +var ( + headerStyle = lipgloss.NewStyle() // .Foreground(lipgloss.Color("#FAFAFA")) + acceptableStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#00FF00")) + unacceptableStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#FF0000")) + textStyle = lipgloss.NewStyle() // .Foreground(lipgloss.Color("#FAFAFA")) + MentionStyle = textStyle.Copy().Italic(true).Foreground(config.UserColor) +) + +type Model struct { + hint *protocol.Hint +} + +func New() Model { + return Model{ + hint: nil, + } +} + +func (m Model) Init() tea.Cmd { + return nil +} + +func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { + switch msg := msg.(type) { + case messages.GameStateMessage: + if msg.State == nil || !msg.State.VotesRevealed { + m.hint = nil + break + } + + issue := msg.State.Issues.Get(msg.State.ActiveIssue) + if issue != nil { + m.hint = issue.Hint + } + } + + return m, nil +} + +func (m Model) View() string { + if m.hint == nil { + return "" + } + + verdictStyle := unacceptableStyle + verdictText := "x" + if m.hint.Acceptable { + verdictStyle = acceptableStyle + verdictText = "✓" + } + + rejectionReason := "" + if !m.hint.Acceptable { + rejectionReason = fmt.Sprintf(" (%s)", textStyle.Render(m.hint.RejectReason)) + } + + return lipgloss.JoinVertical(lipgloss.Top, + "", + headerStyle.Render("Recommended:")+" "+voteview.Render(m.hint.Hint), + headerStyle.Render("Acceptable:")+" "+verdictStyle.Render(verdictText)+rejectionReason, + headerStyle.Render("What to do:")+" "+textStyle.Render(m.hint.Advice), + "", + ) +} diff --git a/internal/view/components/voteview/voteview.go b/internal/view/components/voteview/voteview.go index 9ad77df..4f5a884 100644 --- a/internal/view/components/voteview/voteview.go +++ b/internal/view/components/voteview/voteview.go @@ -1,11 +1,13 @@ package voteview import ( + "strconv" + "github.com/charmbracelet/bubbles/spinner" tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" + "github.com/six78/2-story-points-cli/pkg/protocol" - "strconv" ) var ( @@ -141,3 +143,7 @@ func VoteStyle(vote protocol.VoteValue) *lipgloss.Style { } return &LightVoteStyle } + +func Render(vote protocol.VoteValue) string { + return VoteStyle(vote).Render(string(vote)) +} diff --git a/internal/view/model.go b/internal/view/model.go index 1a67a30..1fcee55 100644 --- a/internal/view/model.go +++ b/internal/view/model.go @@ -2,17 +2,24 @@ package view import ( "fmt" + "net/url" + "strings" + "time" + "github.com/charmbracelet/bubbles/key" "github.com/charmbracelet/bubbles/spinner" tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" "github.com/pkg/errors" + "go.uber.org/zap" + "github.com/six78/2-story-points-cli/internal/config" "github.com/six78/2-story-points-cli/internal/transport" "github.com/six78/2-story-points-cli/internal/view/commands" "github.com/six78/2-story-points-cli/internal/view/components/deckview" "github.com/six78/2-story-points-cli/internal/view/components/errorview" "github.com/six78/2-story-points-cli/internal/view/components/eventhandler" + "github.com/six78/2-story-points-cli/internal/view/components/hintview" "github.com/six78/2-story-points-cli/internal/view/components/issuesview" "github.com/six78/2-story-points-cli/internal/view/components/issueview" "github.com/six78/2-story-points-cli/internal/view/components/playersview" @@ -24,10 +31,6 @@ import ( "github.com/six78/2-story-points-cli/internal/view/update" "github.com/six78/2-story-points-cli/pkg/game" "github.com/six78/2-story-points-cli/pkg/protocol" - "go.uber.org/zap" - "net/url" - "strings" - "time" ) type model struct { @@ -47,6 +50,7 @@ type model struct { roomViewState states.RoomView errorView errorview.Model playersView playersview.Model + hintView hintview.Model shortcutsView shortcutsview.Model wakuStatusView wakustatusview.Model deckView deckview.Model @@ -85,6 +89,7 @@ func initialModel(game *game.Game, transport transport.Service) model { spinner: createSpinner(), errorView: errorview.New(), playersView: playersview.New(), + hintView: hintview.New(), shortcutsView: shortcutsview.New(), wakuStatusView: wakustatusview.New(), deckView: deckView, @@ -109,6 +114,7 @@ func (m model) Init() tea.Cmd { m.spinner.Tick, m.errorView.Init(), m.playersView.Init(), + m.hintView.Init(), m.shortcutsView.Init(), m.wakuStatusView.Init(), m.deckView.Init(), @@ -290,6 +296,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.spinner, cmds.SpinnerCommand = m.spinner.Update(msg) m.errorView = m.errorView.Update(msg) m.playersView, cmds.PlayersCommand = m.playersView.Update(msg) + m.hintView, _ = m.hintView.Update(msg) m.shortcutsView = m.shortcutsView.Update(msg, m.roomViewState) m.wakuStatusView = m.wakuStatusView.Update(msg) m.deckView = m.deckView.Update(msg) diff --git a/internal/view/render.go b/internal/view/render.go index f95dbba..11a2c5a 100644 --- a/internal/view/render.go +++ b/internal/view/render.go @@ -2,10 +2,12 @@ package view import ( "fmt" + "strings" + "github.com/charmbracelet/lipgloss" + "github.com/six78/2-story-points-cli/internal/config" "github.com/six78/2-story-points-cli/internal/view/states" - "strings" ) /* @@ -93,7 +95,7 @@ func (m model) renderRoomCurrentIssueView() string { return lipgloss.JoinVertical(lipgloss.Top, m.issueView.View(), "", - m.playersView.View(), + lipgloss.JoinHorizontal(lipgloss.Left, m.playersView.View(), " ", m.hintView.View()), m.deckView.View(), ) } From 7e3b8460849fb706249e44ae83dd7032b94a1fdf Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Sun, 30 Jun 2024 21:57:07 +0200 Subject: [PATCH 2/4] test: HintView --- .../hintview/{hintview.go => model.go} | 6 +- .../view/components/hintview/model_test.go | 112 ++++++++++++++++++ 2 files changed, 115 insertions(+), 3 deletions(-) rename internal/view/components/hintview/{hintview.go => model.go} (87%) create mode 100644 internal/view/components/hintview/model_test.go diff --git a/internal/view/components/hintview/hintview.go b/internal/view/components/hintview/model.go similarity index 87% rename from internal/view/components/hintview/hintview.go rename to internal/view/components/hintview/model.go index 3df28d8..dcca846 100644 --- a/internal/view/components/hintview/hintview.go +++ b/internal/view/components/hintview/model.go @@ -70,9 +70,9 @@ func (m Model) View() string { return lipgloss.JoinVertical(lipgloss.Top, "", - headerStyle.Render("Recommended:")+" "+voteview.Render(m.hint.Hint), - headerStyle.Render("Acceptable:")+" "+verdictStyle.Render(verdictText)+rejectionReason, - headerStyle.Render("What to do:")+" "+textStyle.Render(m.hint.Advice), + headerStyle.Render("Recommended:")+""+voteview.Render(m.hint.Hint), + headerStyle.Render("Acceptable:")+" "+verdictStyle.Render(verdictText)+rejectionReason, + headerStyle.Render("What to do:")+" "+textStyle.Render(m.hint.Advice), "", ) } diff --git a/internal/view/components/hintview/model_test.go b/internal/view/components/hintview/model_test.go new file mode 100644 index 0000000..c89bd3d --- /dev/null +++ b/internal/view/components/hintview/model_test.go @@ -0,0 +1,112 @@ +package hintview + +import ( + "fmt" + "strings" + "testing" + + "github.com/brianvoe/gofakeit/v6" + "github.com/stretchr/testify/require" + + "github.com/six78/2-story-points-cli/internal/view/messages" + "github.com/six78/2-story-points-cli/pkg/protocol" +) + +func TestInit(t *testing.T) { + model := New() + + cmd := model.Init() + require.Nil(t, cmd) + require.Nil(t, model.hint) +} + +func TestUpdateNilState(t *testing.T) { + model := New() + cmd := model.Init() + model, cmd = model.Update(messages.GameStateMessage{State: nil}) + require.Nil(t, cmd) + require.Nil(t, model.hint) + require.Empty(t, model.View()) +} + +func TestUpdateVotesNotRevealed(t *testing.T) { + model := New() + cmd := model.Init() + model, cmd = model.Update(messages.GameStateMessage{ + State: &protocol.State{ + VotesRevealed: false, + }, + }) + require.Nil(t, cmd) + require.Nil(t, model.hint) + require.Empty(t, model.View()) +} + +func TestUpdateAcceptableVote(t *testing.T) { + model := New() + + cmd := model.Init() + require.Nil(t, cmd) + require.Nil(t, model.hint) + + // Test acceptable vote + + testCases := []struct { + name string + acceptable bool + }{ + { + name: "acceptable vote", + acceptable: true, + }, + { + name: "non-acceptable vote", + acceptable: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + + issue := protocol.Issue{ + ID: protocol.IssueID(gofakeit.UUID()), + Hint: &protocol.Hint{ + Acceptable: tc.acceptable, + Hint: protocol.VoteValue(gofakeit.LetterN(5)), + RejectReason: gofakeit.LetterN(10), + }, + } + model, cmd = model.Update(messages.GameStateMessage{ + State: &protocol.State{ + Issues: protocol.IssuesList{&issue}, + ActiveIssue: issue.ID, + VotesRevealed: true, + }, + }) + require.Nil(t, cmd) + require.NotNil(t, model.hint) + require.Equal(t, *issue.Hint, *model.hint) + + expectedVerdict := "✓" + if !tc.acceptable { + expectedVerdict = "x" + fmt.Sprintf(" (%s)", issue.Hint.RejectReason) + } + + expectedLines := []string{ + "", + "Recommended: " + string(issue.Hint.Hint), + "Acceptable: " + expectedVerdict, + "What to do:", + "", + } + + lines := strings.Split(model.View(), "\n") + require.Len(t, lines, len(expectedLines)) + + for i, line := range lines { + trimmedLine := strings.Trim(line, " ") + require.Equal(t, expectedLines[i], trimmedLine) + } + }) + } +} From 7d5b2f61dc54e67aa6e6278a60e0020ddf0430ad Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Sun, 30 Jun 2024 23:39:08 +0100 Subject: [PATCH 3/4] chore: deck separate file, rename Hint.Hint to Hint.Value --- internal/view/components/hintview/model.go | 2 +- .../view/components/hintview/model_test.go | 4 ++-- pkg/game/hints.go | 5 ++-- pkg/game/hints_test.go | 24 +++++++++---------- pkg/protocol/deck.go | 9 +++++++ pkg/protocol/hint.go | 4 ++-- pkg/protocol/messages.go | 2 -- pkg/protocol/state.go | 15 ++++++++++++ 8 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 pkg/protocol/deck.go diff --git a/internal/view/components/hintview/model.go b/internal/view/components/hintview/model.go index dcca846..8a32aa5 100644 --- a/internal/view/components/hintview/model.go +++ b/internal/view/components/hintview/model.go @@ -70,7 +70,7 @@ func (m Model) View() string { return lipgloss.JoinVertical(lipgloss.Top, "", - headerStyle.Render("Recommended:")+""+voteview.Render(m.hint.Hint), + headerStyle.Render("Recommended:")+""+voteview.Render(m.hint.Value), headerStyle.Render("Acceptable:")+" "+verdictStyle.Render(verdictText)+rejectionReason, headerStyle.Render("What to do:")+" "+textStyle.Render(m.hint.Advice), "", diff --git a/internal/view/components/hintview/model_test.go b/internal/view/components/hintview/model_test.go index c89bd3d..b096199 100644 --- a/internal/view/components/hintview/model_test.go +++ b/internal/view/components/hintview/model_test.go @@ -72,7 +72,7 @@ func TestUpdateAcceptableVote(t *testing.T) { ID: protocol.IssueID(gofakeit.UUID()), Hint: &protocol.Hint{ Acceptable: tc.acceptable, - Hint: protocol.VoteValue(gofakeit.LetterN(5)), + Value: protocol.VoteValue(gofakeit.LetterN(5)), RejectReason: gofakeit.LetterN(10), }, } @@ -94,7 +94,7 @@ func TestUpdateAcceptableVote(t *testing.T) { expectedLines := []string{ "", - "Recommended: " + string(issue.Hint.Hint), + "Recommended: " + string(issue.Hint.Value), "Acceptable: " + expectedVerdict, "What to do:", "", diff --git a/pkg/game/hints.go b/pkg/game/hints.go index 93fda73..30a5f13 100644 --- a/pkg/game/hints.go +++ b/pkg/game/hints.go @@ -5,7 +5,6 @@ import ( "sort" "github.com/pkg/errors" - "golang.org/x/exp/slices" "github.com/six78/2-story-points-cli/pkg/protocol" ) @@ -50,7 +49,7 @@ func GetResultHint(deck protocol.Deck, issueVotes protocol.IssueVotes) (*protoco // Build the hint based on the measures hint := &protocol.Hint{ - Hint: medianValue, + Value: medianValue, Advice: "", Acceptable: true, } @@ -71,7 +70,7 @@ func GetResultHint(deck protocol.Deck, issueVotes protocol.IssueVotes) (*protoco func getVotesAsDeckIndexes(issueVotes protocol.IssueVotes, deck protocol.Deck) ([]int, error) { indexes := make([]int, 0, len(issueVotes)) for _, vote := range issueVotes { - index := slices.Index(deck, vote.Value) + index := deck.Index(vote.Value) if index < 0 { return nil, ErrVoteNotFoundInDeck } diff --git a/pkg/game/hints_test.go b/pkg/game/hints_test.go index 4dec9c2..1705536 100644 --- a/pkg/game/hints_test.go +++ b/pkg/game/hints_test.go @@ -49,64 +49,64 @@ func TestHint(t *testing.T) { { values: []protocol.VoteValue{"3", "3", "3", "3", "5"}, measurements: hintMeasurements{median: 2, meanDeviation: 0.2, maxDeviation: 1}, - expectedHint: protocol.Hint{Acceptable: true, Hint: "3"}, + expectedHint: protocol.Hint{Acceptable: true, Value: "3"}, }, { values: []protocol.VoteValue{"3", "3", "3", "3", "8"}, measurements: hintMeasurements{median: 2, meanDeviation: 0.4, maxDeviation: 2}, - expectedHint: protocol.Hint{Acceptable: false, Hint: "3", RejectReason: maximumDeviationIsTooHigh}, + expectedHint: protocol.Hint{Acceptable: false, Value: "3", RejectReason: maximumDeviationIsTooHigh}, }, { values: []protocol.VoteValue{"3", "3", "3", "3", "13"}, measurements: hintMeasurements{median: 2, meanDeviation: 0.6, maxDeviation: 3}, // Test: varietyOfVotesIsTooHigh takes precedence over maximumDeviationIsTooHigh - expectedHint: protocol.Hint{Acceptable: false, Hint: "3", RejectReason: varietyOfVotesIsTooHigh}, + expectedHint: protocol.Hint{Acceptable: false, Value: "3", RejectReason: varietyOfVotesIsTooHigh}, }, { values: []protocol.VoteValue{"3", "3", "3", "3", "21"}, measurements: hintMeasurements{median: 2, meanDeviation: 0.8, maxDeviation: 4}, - expectedHint: protocol.Hint{Acceptable: false, Hint: "3", RejectReason: varietyOfVotesIsTooHigh}, + expectedHint: protocol.Hint{Acceptable: false, Value: "3", RejectReason: varietyOfVotesIsTooHigh}, }, { values: []protocol.VoteValue{"3", "3", "3", "5", "5"}, measurements: hintMeasurements{median: 2, meanDeviation: 0.4, maxDeviation: 1}, - expectedHint: protocol.Hint{Acceptable: true, Hint: "3"}, + expectedHint: protocol.Hint{Acceptable: true, Value: "3"}, }, { values: []protocol.VoteValue{"3", "3", "3", "5", "8"}, measurements: hintMeasurements{median: 2, meanDeviation: 0.6, maxDeviation: 2}, - expectedHint: protocol.Hint{Acceptable: false, Hint: "3", RejectReason: varietyOfVotesIsTooHigh}, + expectedHint: protocol.Hint{Acceptable: false, Value: "3", RejectReason: varietyOfVotesIsTooHigh}, }, { values: []protocol.VoteValue{"2", "3", "3", "3", "3", "3", "5"}, measurements: hintMeasurements{median: 2, meanDeviation: 2 / 7.0, maxDeviation: 1}, - expectedHint: protocol.Hint{Acceptable: true, Hint: "3"}, + expectedHint: protocol.Hint{Acceptable: true, Value: "3"}, }, { values: []protocol.VoteValue{"2", "3", "3", "3", "3", "5"}, measurements: hintMeasurements{median: 2, meanDeviation: 2 / 6.0, maxDeviation: 1}, - expectedHint: protocol.Hint{Acceptable: true, Hint: "3"}, + expectedHint: protocol.Hint{Acceptable: true, Value: "3"}, }, { values: []protocol.VoteValue{"2", "3", "3", "3", "5"}, measurements: hintMeasurements{median: 2, meanDeviation: 2 / 5.0, maxDeviation: 1}, - expectedHint: protocol.Hint{Acceptable: true, Hint: "3"}, + expectedHint: protocol.Hint{Acceptable: true, Value: "3"}, }, { values: []protocol.VoteValue{"2", "3", "3", "5"}, measurements: hintMeasurements{median: 2, meanDeviation: 2 / 4.0, maxDeviation: 1}, - expectedHint: protocol.Hint{Acceptable: false, Hint: "3", RejectReason: varietyOfVotesIsTooHigh}, + expectedHint: protocol.Hint{Acceptable: false, Value: "3", RejectReason: varietyOfVotesIsTooHigh}, }, { values: []protocol.VoteValue{"2", "3", "5"}, measurements: hintMeasurements{median: 2, meanDeviation: 2 / 3.0, maxDeviation: 1}, - expectedHint: protocol.Hint{Acceptable: false, Hint: "3", RejectReason: varietyOfVotesIsTooHigh}, + expectedHint: protocol.Hint{Acceptable: false, Value: "3", RejectReason: varietyOfVotesIsTooHigh}, }, { // This also tests round up median when even number of votes values: []protocol.VoteValue{"2", "3", "5", "8"}, measurements: hintMeasurements{median: 3, meanDeviation: 1, maxDeviation: 2}, - expectedHint: protocol.Hint{Acceptable: false, Hint: "5", RejectReason: varietyOfVotesIsTooHigh}, + expectedHint: protocol.Hint{Acceptable: false, Value: "5", RejectReason: varietyOfVotesIsTooHigh}, }, } diff --git a/pkg/protocol/deck.go b/pkg/protocol/deck.go new file mode 100644 index 0000000..8a461e5 --- /dev/null +++ b/pkg/protocol/deck.go @@ -0,0 +1,9 @@ +package protocol + +import "golang.org/x/exp/slices" + +type Deck []VoteValue + +func (d Deck) Index(value VoteValue) int { + return slices.Index(d, value) +} diff --git a/pkg/protocol/hint.go b/pkg/protocol/hint.go index f2ca80f..f9fe698 100644 --- a/pkg/protocol/hint.go +++ b/pkg/protocol/hint.go @@ -10,9 +10,9 @@ type Hint struct { // When Acceptable is true, RejectReason is empty. RejectReason string - // Hint is the recommended value for the issue. + // Value is the recommended value for the issue. // It's guaranteed to be one of the values from the deck. - Hint VoteValue + Value VoteValue // Advice is a text advice for the team about current vote. // It might contain players mentions in form "@", where a particular player ID. diff --git a/pkg/protocol/messages.go b/pkg/protocol/messages.go index ebd123c..3e2b2d2 100644 --- a/pkg/protocol/messages.go +++ b/pkg/protocol/messages.go @@ -49,6 +49,4 @@ type PlayerVoteMessage struct { VoteResult VoteResult `json:"vote"` } -type Deck []VoteValue - type IssueVotes map[PlayerID]VoteResult diff --git a/pkg/protocol/state.go b/pkg/protocol/state.go index 32a7db6..1967c5a 100644 --- a/pkg/protocol/state.go +++ b/pkg/protocol/state.go @@ -37,3 +37,18 @@ func (s *State) VoteState() VoteState { } return FinishedState } + +func (s *State) GetActiveIssue() *Issue { + return s.Issues.Get(s.ActiveIssue) +} + +func (s *State) ActiveIssueHintDeckIndex() int { + issue := s.GetActiveIssue() + if issue == nil { + return -1 + } + if issue.Hint == nil { + return -1 + } + return s.Deck.Index(issue.Hint.Value) +} From 608fd4c2dd8b6579415ce88f639d612eedaee7f4 Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Sun, 30 Jun 2024 23:41:39 +0100 Subject: [PATCH 4/4] fix: linter --- internal/view/components/hintview/model_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/view/components/hintview/model_test.go b/internal/view/components/hintview/model_test.go index b096199..3b54990 100644 --- a/internal/view/components/hintview/model_test.go +++ b/internal/view/components/hintview/model_test.go @@ -14,7 +14,6 @@ import ( func TestInit(t *testing.T) { model := New() - cmd := model.Init() require.Nil(t, cmd) require.Nil(t, model.hint) @@ -22,8 +21,8 @@ func TestInit(t *testing.T) { func TestUpdateNilState(t *testing.T) { model := New() - cmd := model.Init() - model, cmd = model.Update(messages.GameStateMessage{State: nil}) + _ = model.Init() + model, cmd := model.Update(messages.GameStateMessage{State: nil}) require.Nil(t, cmd) require.Nil(t, model.hint) require.Empty(t, model.View()) @@ -31,8 +30,8 @@ func TestUpdateNilState(t *testing.T) { func TestUpdateVotesNotRevealed(t *testing.T) { model := New() - cmd := model.Init() - model, cmd = model.Update(messages.GameStateMessage{ + _ = model.Init() + model, cmd := model.Update(messages.GameStateMessage{ State: &protocol.State{ VotesRevealed: false, },