docs: update README with detailed desktop features and setup requirements
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package history
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"tea.chunkbyte.com/kato/captioneer/src/captions"
|
||||
)
|
||||
|
||||
func TestHistoryKeepsFinalsBoundedAndProvisionalSeparate(t *testing.T) {
|
||||
sink := New(2, true)
|
||||
_ = sink.Publish(captions.Event{Kind: captions.Provisional, Text: "draft"})
|
||||
if sink.Snapshot().Provisional == nil {
|
||||
t.Fatal("provisional caption was not retained")
|
||||
}
|
||||
for _, text := range []string{"one", "two", "three"} {
|
||||
_ = sink.Publish(captions.Event{Kind: captions.Final, Text: text})
|
||||
}
|
||||
snapshot := sink.Snapshot()
|
||||
if snapshot.Provisional != nil || len(snapshot.Finals) != 2 || snapshot.Finals[0].Text != "two" {
|
||||
t.Fatalf("snapshot = %#v", snapshot)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDisabledHistoryKeepsExistingFinalsButStopsRecording(t *testing.T) {
|
||||
sink := New(10, true)
|
||||
_ = sink.Publish(captions.Event{Kind: captions.Final, Text: "kept"})
|
||||
sink.SetEnabled(false)
|
||||
_ = sink.Publish(captions.Event{Kind: captions.Final, Text: "ignored"})
|
||||
if got := sink.Transcript(); got != "kept" {
|
||||
t.Fatalf("transcript = %q", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user