1
1
import { expect , test } from 'bun:test' ;
2
- import { provider } from './src/index.ts' ;
2
+ import { scanner } from './src/index.ts' ;
3
3
4
4
/////////////////////////////////////////////////////////////////////////////////////
5
5
// This test file is mostly just here to get you up and running quickly. It's
6
6
// likely you'd want to improve or remove this, and add more coverage for your
7
7
// own code.
8
8
/////////////////////////////////////////////////////////////////////////////////////
9
9
10
- test ( 'Provider should warn about known malicious packages' , async ( ) => {
11
- const advisories = await provider . scan ( {
10
+ test ( 'Scanner should warn about known malicious packages' , async ( ) => {
11
+ const advisories = await scanner . scan ( {
12
12
packages : [
13
13
{
14
14
name : 'event-stream' ,
@@ -32,12 +32,12 @@ test('Provider should warn about known malicious packages', async () => {
32
32
} ) ;
33
33
34
34
test ( 'There should be no advisories if no packages are being installed' , async ( ) => {
35
- const advisories = await provider . scan ( { packages : [ ] } ) ;
35
+ const advisories = await scanner . scan ( { packages : [ ] } ) ;
36
36
expect ( advisories . length ) . toBe ( 0 ) ;
37
37
} ) ;
38
38
39
39
test ( 'Safe packages should return no advisories' , async ( ) => {
40
- const advisories = await provider . scan ( {
40
+ const advisories = await scanner . scan ( {
41
41
packages : [
42
42
{
43
43
name : 'lodash' ,
@@ -51,7 +51,7 @@ test('Safe packages should return no advisories', async () => {
51
51
} ) ;
52
52
53
53
test ( 'Should handle multiple packages with mixed security status' , async ( ) => {
54
- const advisories = await provider . scan ( {
54
+ const advisories = await scanner . scan ( {
55
55
packages : [
56
56
{
57
57
name : 'event-stream' ,
@@ -73,7 +73,7 @@ test('Should handle multiple packages with mixed security status', async () => {
73
73
} ) ;
74
74
75
75
test ( 'Should differentiate between versions of the same package' , async ( ) => {
76
- const maliciousVersion = await provider . scan ( {
76
+ const maliciousVersion = await scanner . scan ( {
77
77
packages : [
78
78
{
79
79
name : 'event-stream' ,
@@ -84,7 +84,7 @@ test('Should differentiate between versions of the same package', async () => {
84
84
] ,
85
85
} ) ;
86
86
87
- const safeVersion = await provider . scan ( {
87
+ const safeVersion = await scanner . scan ( {
88
88
packages : [
89
89
{
90
90
name : 'event-stream' ,
@@ -100,7 +100,7 @@ test('Should differentiate between versions of the same package', async () => {
100
100
} ) ;
101
101
102
102
test ( 'Should handle scoped packages correctly' , async ( ) => {
103
- const advisories = await provider . scan ( {
103
+ const advisories = await scanner . scan ( {
104
104
packages : [
105
105
{
106
106
name : '@types/node' ,
0 commit comments