mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-01-18 16:17:26 +01:00
Fix randomly failing test
This commit is contained in:
@@ -44,7 +44,7 @@ func TestSniffWriter_WriteUnknownMimeType(t *testing.T) {
|
|||||||
rr := httptest.NewRecorder()
|
rr := httptest.NewRecorder()
|
||||||
sw := NewContentTypeWriter(rr, "")
|
sw := NewContentTypeWriter(rr, "")
|
||||||
randomBytes := make([]byte, 199)
|
randomBytes := make([]byte, 199)
|
||||||
rand.Read(randomBytes)
|
rand.Read(randomBytes[5:]) // Start at an offset; the test kept failing randomly because it hit random magic strings
|
||||||
sw.Write(randomBytes)
|
sw.Write(randomBytes)
|
||||||
require.Equal(t, "application/octet-stream", rr.Header().Get("Content-Type"))
|
require.Equal(t, "application/octet-stream", rr.Header().Get("Content-Type"))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user