docs: update README with detailed desktop features and setup requirements
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package transcript
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"tea.chunkbyte.com/kato/captioneer/src/captions"
|
||||
)
|
||||
|
||||
func TestTranscriptWritesOnlyFinalCaptionsWithWallClockAndOffsets(t *testing.T) {
|
||||
now := time.Date(2026, 7, 17, 12, 34, 56, 123000000, time.UTC)
|
||||
sink, err := newWithClock(t.TempDir(), func() time.Time { return now })
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := sink.Publish(captions.Event{Kind: captions.Provisional, Text: "draft"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := sink.Publish(captions.Event{
|
||||
Kind: captions.Final, Text: "hello\nthere", StartedAt: time.Second, EndedAt: 2500 * time.Millisecond,
|
||||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := sink.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := os.ReadFile(sink.Path())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := "2026-07-17T12:34:56.123Z [1.00s-2.50s] hello there\n"
|
||||
if string(data) != want {
|
||||
t.Fatalf("transcript = %q, want %q", data, want)
|
||||
}
|
||||
if !strings.Contains(sink.Path(), "captioneer-2026-07-17_12-34-56.123.log") {
|
||||
t.Fatalf("unexpected transcript path %q", sink.Path())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user