github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/internal/controllers/fake/store.go (about)

     1  package fake
     2  
     3  import (
     4  	"io"
     5  
     6  	"github.com/tilt-dev/tilt/internal/store"
     7  )
     8  
     9  type testStore struct {
    10  	*store.TestingStore
    11  	out io.Writer
    12  }
    13  
    14  func NewTestingStore(out io.Writer) *testStore {
    15  	return &testStore{
    16  		TestingStore: store.NewTestingStore(),
    17  		out:          out,
    18  	}
    19  }
    20  
    21  func (s *testStore) Dispatch(action store.Action) {
    22  	s.TestingStore.Dispatch(action)
    23  	if action, ok := action.(store.LogAction); ok {
    24  		_, _ = s.out.Write(action.Message())
    25  	}
    26  }