Skip to content

Commit f4ea306

Browse files
committed
Fix type definitions in malware mock API
Extend types to include API fields not in base types: - Add category and file fields to ExtendedAlert - Add size and batchIndex to CompactSocketArtifactWithScore - Remove unused vi import
1 parent 1a420e5 commit f4ea306

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

test/mock-malware-api.mts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,30 @@
33
* Provides utilities to mock Socket API responses with malware alerts.
44
*/
55

6-
import { vi } from 'vitest'
6+
import type {
7+
CompactSocketArtifact,
8+
CompactSocketArtifactAlert,
9+
} from '../src/utils/alert/artifact.mts'
710

8-
import type { CompactSocketArtifact } from '../src/utils/alert/artifact.mts'
11+
/**
12+
* Extended alert type with additional API fields not in base type.
13+
*/
14+
export type ExtendedAlert = CompactSocketArtifactAlert & {
15+
category?: string
16+
file?: string
17+
}
918

1019
/**
11-
* Extended CompactSocketArtifact type with score property for testing.
12-
* In practice, the API returns score data but it's not in the base type.
20+
* Extended CompactSocketArtifact type with additional API fields for testing.
21+
* The API returns score, size, and batchIndex data not included in the base type.
1322
*/
14-
export type CompactSocketArtifactWithScore = CompactSocketArtifact & {
23+
export type CompactSocketArtifactWithScore = Omit<
24+
CompactSocketArtifact,
25+
'alerts'
26+
> & {
27+
alerts: ExtendedAlert[]
28+
batchIndex?: number
29+
size?: number
1530
score?: {
1631
license: number
1732
maintenance: number

0 commit comments

Comments
 (0)