@@ -78,9 +78,9 @@ public async Task TestNpmDetector_AuthorNameAndAuthorEmailDetected_WhenAuthorNam
78
78
{
79
79
var authorName = GetRandomString ( ) ;
80
80
var authorEmail = GetRandomString ( ) ;
81
- var authroUrl = GetRandomString ( ) ;
81
+ var authorUrl = GetRandomString ( ) ;
82
82
var ( packageJsonName , packageJsonContents , packageJsonPath ) =
83
- NpmTestUtilities . GetPackageJsonNoDependenciesForAuthorAndEmailAsSingleString ( authorName , authorEmail , authroUrl ) ;
83
+ NpmTestUtilities . GetPackageJsonNoDependenciesForAuthorAndEmailAsSingleString ( authorName , authorEmail , authorUrl ) ;
84
84
85
85
var ( scanResult , componentRecorder ) = await this . DetectorTestUtility
86
86
. WithFile ( packageJsonName , packageJsonContents , this . packageJsonSearchPattern , fileLocation : packageJsonPath )
@@ -97,9 +97,9 @@ public async Task TestNpmDetector_AuthorNameAndAuthorEmailDetected_WhenAuthorNam
97
97
public async Task TestNpmDetector_AuthorNameDetected_WhenEmailNotPresentAndUrlIsPresent_AuthorAsSingleStringAsync ( )
98
98
{
99
99
var authorName = GetRandomString ( ) ;
100
- var authroUrl = GetRandomString ( ) ;
100
+ var authorUrl = GetRandomString ( ) ;
101
101
var ( packageJsonName , packageJsonContents , packageJsonPath ) =
102
- NpmTestUtilities . GetPackageJsonNoDependenciesForAuthorAndEmailAsSingleString ( authorName , null , authroUrl ) ;
102
+ NpmTestUtilities . GetPackageJsonNoDependenciesForAuthorAndEmailAsSingleString ( authorName , null , authorUrl ) ;
103
103
104
104
var ( scanResult , componentRecorder ) = await this . DetectorTestUtility
105
105
. WithFile ( packageJsonName , packageJsonContents , this . packageJsonSearchPattern , fileLocation : packageJsonPath )
@@ -116,10 +116,10 @@ public async Task TestNpmDetector_AuthorNameDetected_WhenEmailNotPresentAndUrlIs
116
116
public async Task TestNpmDetector_AuthorNull_WhenAuthorMalformed_AuthorAsSingleStringAsync ( )
117
117
{
118
118
var authorName = GetRandomString ( ) ;
119
- var authroUrl = GetRandomString ( ) ;
119
+ var authorUrl = GetRandomString ( ) ;
120
120
var authorEmail = GetRandomString ( ) ;
121
121
var ( packageJsonName , packageJsonContents , packageJsonPath ) =
122
- NpmTestUtilities . GetPackageJsonNoDependenciesMalformedAuthorAsSingleString ( authorName , authorEmail , authroUrl ) ;
122
+ NpmTestUtilities . GetPackageJsonNoDependenciesMalformedAuthorAsSingleString ( authorName , authorEmail , authorUrl ) ;
123
123
124
124
var ( scanResult , componentRecorder ) = await this . DetectorTestUtility
125
125
. WithFile ( packageJsonName , packageJsonContents , this . packageJsonSearchPattern , fileLocation : packageJsonPath )
@@ -135,7 +135,6 @@ public async Task TestNpmDetector_AuthorNull_WhenAuthorMalformed_AuthorAsSingleS
135
135
public async Task TestNpmDetector_AuthorNameDetected_WhenEmailNotPresentAndUrlNotPresent_AuthorAsSingleStringAsync ( )
136
136
{
137
137
var authorName = GetRandomString ( ) ;
138
- var authroUrl = GetRandomString ( ) ;
139
138
var ( packageJsonName , packageJsonContents , packageJsonPath ) =
140
139
NpmTestUtilities . GetPackageJsonNoDependenciesForAuthorAndEmailAsSingleString ( authorName ) ;
141
140
@@ -208,6 +207,38 @@ public async Task TestNpmDetector_NullAuthor_WhenAuthorNameIsNullOrEmpty_AuthorA
208
207
( ( NpmComponent ) detectedComponents . First ( ) . Component ) . Author . Should ( ) . BeNull ( ) ;
209
208
}
210
209
210
+ [ TestMethod ]
211
+ public async Task TestNpmDetector_NodeEngineDoesNotCauseSkippedPackageAsync ( )
212
+ {
213
+ var componentName = GetRandomString ( ) ;
214
+ var version = NewRandomVersion ( ) ;
215
+ var ( packageJsonName , packageJsonContents , packageJsonPath ) =
216
+ NpmTestUtilities . GetPackageJsonNoDependenciesForNameAndVersionWithNodeEngine ( componentName , version ) ;
217
+
218
+ var ( scanResult , componentRecorder ) = await this . DetectorTestUtility
219
+ . WithFile ( packageJsonName , packageJsonContents , this . packageJsonSearchPattern , fileLocation : packageJsonPath )
220
+ . ExecuteDetectorAsync ( ) ;
221
+ scanResult . ResultCode . Should ( ) . Be ( ProcessingResultCode . Success ) ;
222
+ var detectedComponents = componentRecorder . GetDetectedComponents ( ) ;
223
+ detectedComponents . Should ( ) . ContainSingle ( ) ;
224
+ }
225
+
226
+ [ TestMethod ]
227
+ public async Task TestNpmDetector_VSCodeEngineCausesSkippedPackageAsync ( )
228
+ {
229
+ var componentName = GetRandomString ( ) ;
230
+ var version = NewRandomVersion ( ) ;
231
+ var ( packageJsonName , packageJsonContents , packageJsonPath ) =
232
+ NpmTestUtilities . GetPackageJsonNoDependenciesForNameAndVersionWithVSCodeEngine ( componentName , version ) ;
233
+
234
+ var ( scanResult , componentRecorder ) = await this . DetectorTestUtility
235
+ . WithFile ( packageJsonName , packageJsonContents , this . packageJsonSearchPattern , fileLocation : packageJsonPath )
236
+ . ExecuteDetectorAsync ( ) ;
237
+ scanResult . ResultCode . Should ( ) . Be ( ProcessingResultCode . Success ) ;
238
+ var detectedComponents = componentRecorder . GetDetectedComponents ( ) ;
239
+ detectedComponents . Should ( ) . BeEmpty ( ) ;
240
+ }
241
+
211
242
private static void AssertDetectedComponentCount ( IEnumerable < DetectedComponent > detectedComponents , int expectedCount )
212
243
{
213
244
detectedComponents . Should ( ) . HaveCount ( expectedCount ) ;
0 commit comments