MCPcopy Create free account
hub / github.com/UiPath/uipathcli / TestFileStreamData

Function TestFileStreamData

utils/stream/file_stream_test.go:35–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33}
34
35func TestFileStreamData(t *testing.T) {
36 path := createFile(t, "my-file.txt", "hello-world")
37 stream := NewFileStream(path)
38
39 reader, err := stream.Data()
40 data, _ := io.ReadAll(reader)
41 defer func() {
42 err := reader.Close()
43 if err != nil {
44 t.Errorf("Should not return error when closing reader, but got: %v", err)
45 }
46 }()
47
48 if string(data) != "hello-world" {
49 t.Errorf("Did not return provided data, but got: %v", string(data))
50 }
51 if err != nil {
52 t.Errorf("Should not return error, but got: %v", err)
53 }
54}
55
56func TestFileStreamFileNotFound(t *testing.T) {
57 stream := NewFileStream("unknown-path/my-file.txt")

Callers

nothing calls this directly

Calls 4

DataMethod · 0.95
NewFileStreamFunction · 0.85
CloseMethod · 0.80
createFileFunction · 0.70

Tested by

no test coverage detected