Skip to content

Commit

Permalink
chore: update View method signature in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Jan 30, 2025
1 parent 67f8ede commit ff6833c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tea

import (
"bytes"
"fmt"
"os/exec"
"runtime"
"testing"
Expand Down Expand Up @@ -34,7 +35,7 @@ func (m *testExecModel) Update(msg Msg) (*testExecModel, Cmd) {
return m, nil
}

func (m *testExecModel) View() Frame {
func (m *testExecModel) View() fmt.Stringer {
return NewFrame("\n")
}

Expand Down
9 changes: 5 additions & 4 deletions tea_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"context"
"errors"
"fmt"
"io"
"sync/atomic"
"testing"
Expand Down Expand Up @@ -50,7 +51,7 @@ func (m *testModel) Update(msg Msg) (*testModel, Cmd) {
return m, nil
}

func (m *testModel) View() Frame {
func (m *testModel) View() fmt.Stringer {
m.executed.Store(true)
return NewFrame("success\n")
}
Expand Down Expand Up @@ -85,7 +86,7 @@ func TestTeaQuit(t *testing.T) {
go func() {
for {
time.Sleep(time.Millisecond)
if p.Model.executed.Load() != nil {
if p.Model != nil && p.Model.executed.Load() != nil {
p.Quit()
return
}
Expand Down Expand Up @@ -143,7 +144,7 @@ func TestTeaKill(t *testing.T) {
go func() {
for {
time.Sleep(time.Millisecond)
if p.Model.executed.Load() != nil {
if p.Model != nil && p.Model.executed.Load() != nil {
p.Kill()
return
}
Expand All @@ -168,7 +169,7 @@ func TestTeaContext(t *testing.T) {
go func() {
for {
time.Sleep(time.Millisecond)
if p.Model.executed.Load() != nil {
if p.Model != nil && p.Model.executed.Load() != nil {
cancel()
return
}
Expand Down

0 comments on commit ff6833c

Please sign in to comment.