Issue: Add unit tests for BufferWriter in cmd/ci/writer.go
Summary
The BufferWriter test double in cmd/ci/writer.go currently has zero test
coverage on its Write and Exist methods.
Motivation
BufferWriter is used as an in-memory WorkflowWriter fake in tests. If its
behaviour changes silently, higher-level tests can start passing or failing
for the wrong reason.
- Its behaviour is small but non-trivial:
Write must record the path,
replace existing buffer contents, and Exist must reflect whether any data
has been written.
Proposed Change
Add a new file cmd/ci/writer_test.go (package ci_test) that covers:
| Scenario |
Method |
Exist returns false before any write |
BufferWriter.Exist |
Exist returns true after a write |
BufferWriter.Exist |
Write stores the provided path |
BufferWriter.Write |
| Consecutive writes reset the buffer instead of appending |
BufferWriter.Write |
Affected Files
- New:
cmd/ci/writer_test.go
Labels
kind/test, good first issue
Issue: Add unit tests for
BufferWriterincmd/ci/writer.goSummary
The
BufferWritertest double incmd/ci/writer.gocurrently has zero testcoverage on its
WriteandExistmethods.Motivation
BufferWriteris used as an in-memoryWorkflowWriterfake in tests. If itsbehaviour changes silently, higher-level tests can start passing or failing
for the wrong reason.
Writemust record the path,replace existing buffer contents, and
Existmust reflect whether any datahas been written.
Proposed Change
Add a new file
cmd/ci/writer_test.go(package ci_test) that covers:Existreturnsfalsebefore any writeBufferWriter.ExistExistreturnstrueafter a writeBufferWriter.ExistWritestores the provided pathBufferWriter.WriteBufferWriter.WriteAffected Files
cmd/ci/writer_test.goLabels
kind/test,good first issue