Skip to content

Commit 90787d8

Browse files
committed
add new asserts
1 parent ff573ad commit 90787d8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pkg/engine/engine_test.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,10 +1371,8 @@ func TestEngine_DetectChunk_UsesVerifyFlag(t *testing.T) {
13711371

13721372
// Arrange: Create a chunk to detect.
13731373
chunk := detectableChunk{
1374-
chunk: sources.Chunk{
1375-
SourceVerify: true,
1376-
},
13771374
detector: detectorMatches[0],
1375+
verify: true,
13781376
wgDoneFn: func() {},
13791377
}
13801378

@@ -1416,10 +1414,12 @@ func TestEngine_ScannerWorker_DetectableChunkHasCorrectVerifyFlag(t *testing.T)
14161414
// Act
14171415
go e.scannerWorker(ctx)
14181416

1419-
// Assert: Confirm that a chunk was generated and that it has the expected verify flag.
1417+
// Assert: Confirm that a chunk was generated, that its SourceVerify flag is unchanged, and that its verify flag is
1418+
// correctly set.
14201419
select {
14211420
case chunk := <-e.detectableChunksChan:
14221421
assert.True(t, chunk.chunk.SourceVerify)
1422+
assert.True(t, chunk.verify)
14231423
case <-time.After(1 * time.Second):
14241424
t.Errorf("expected a detectableChunk but did not get one")
14251425
}
@@ -1481,11 +1481,13 @@ func TestEngine_VerificationOverlapWorker_DetectableChunkHasCorrectVerifyFlag(t
14811481
assert.False(t, result.Result.Verified)
14821482
}
14831483

1484-
// Assert: Confirm that every generated detectable chunk carries the original Verify flag.
1484+
// Assert: Confirm that every generated detectable chunk's Chunk.SourceVerify flag is unchanged and that its
1485+
// verify flag is correctly set.
14851486
// CMR: There should be not be any of these chunks. However, due to what I believe is an unrelated bug, there
14861487
// are. This test ensures that even in that erroneous case, their Verify flag is correct.
14871488
for detectableChunk := range processedDetectableChunks {
14881489
assert.True(t, detectableChunk.chunk.SourceVerify)
1490+
assert.True(t, detectableChunk.verify)
14891491
}
14901492
})
14911493
t.Run("no overlap", func(t *testing.T) {
@@ -1534,9 +1536,10 @@ func TestEngine_VerificationOverlapWorker_DetectableChunkHasCorrectVerifyFlag(t
15341536
close(e.detectableChunksChan)
15351537
close(processedDetectableChunks)
15361538

1537-
// Assert: Confirm that every generated detectable chunk carries the original Verify flag.
1539+
// Assert: Confirm that SourceVerify flags are unchanged, and verify flags are correctly set.
15381540
for detectableChunk := range processedDetectableChunks {
15391541
assert.True(t, detectableChunk.chunk.SourceVerify)
1542+
assert.True(t, detectableChunk.verify)
15401543
}
15411544
})
15421545
}

0 commit comments

Comments
 (0)