@@ -4,11 +4,7 @@ import { AzureDevOpsWebApiClient } from '../azure-devops/AzureDevOpsWebApiClient
4
4
import { IPullRequestProperties } from '../azure-devops/interfaces/IPullRequest' ;
5
5
import { IDependabotUpdate } from '../dependabot/interfaces/IDependabotConfig' ;
6
6
import { ISharedVariables } from '../getSharedVariables' ;
7
- import {
8
- DependabotDependenciesSchema ,
9
- DependabotOutputProcessor ,
10
- DependabotStoredDependencyListsSchema ,
11
- } from './DependabotOutputProcessor' ;
7
+ import { DependabotDependenciesSchema , DependabotOutputProcessor } from './DependabotOutputProcessor' ;
12
8
import { IDependabotUpdateOperation } from './interfaces/IDependabotUpdateOperation' ;
13
9
14
10
jest . mock ( '../azure-devops/AzureDevOpsWebApiClient' ) ;
@@ -53,23 +49,8 @@ describe('DependabotOutputProcessor', () => {
53
49
data = { } ;
54
50
} ) ;
55
51
56
- it ( 'should skip processing "update_dependency_list" if "storeDependencyList" is false' , async ( ) => {
57
- taskInputs . storeDependencyList = false ;
58
- prAuthorClient . updateProjectProperty = jest . fn ( ) . mockResolvedValue ( false ) ;
59
-
60
- const result = await processor . process ( update , 'update_dependency_list' , {
61
- ...data ,
62
- dependencies : [ ] ,
63
- dependency_files : [ ] ,
64
- } ) ;
65
-
66
- expect ( result ) . toBe ( true ) ;
67
- expect ( prApproverClient . updateProjectProperty ) . not . toHaveBeenCalled ( ) ;
68
- } ) ;
69
-
70
52
it ( 'should process "update_dependency_list"' , async ( ) => {
71
53
taskInputs . storeDependencyList = true ;
72
- prAuthorClient . updateProjectProperty = jest . fn ( ) . mockResolvedValue ( true ) ;
73
54
74
55
const result = await processor . process ( update , 'update_dependency_list' , {
75
56
...data ,
@@ -78,7 +59,6 @@ describe('DependabotOutputProcessor', () => {
78
59
} ) ;
79
60
80
61
expect ( result ) . toBe ( true ) ;
81
- expect ( prAuthorClient . updateProjectProperty ) . toHaveBeenCalled ( ) ;
82
62
} ) ;
83
63
84
64
it ( 'should skip processing "create_pull_request" if "skipPullRequests" is true' , async ( ) => {
@@ -292,38 +272,5 @@ describe('DependabotOutputProcessor', () => {
292
272
expect ( data [ 'dependencies' ] [ 3 ] . requirements [ 0 ] . requirement ) . toEqual ( '8.1.0' ) ;
293
273
expect ( data [ 'dependencies' ] [ 3 ] . requirements [ 0 ] . groups ) . toEqual ( [ 'dependencies' ] ) ;
294
274
} ) ;
295
-
296
- it ( 'works for an existing value' , ( ) => {
297
- const rawNuget = JSON . parse ( fs . readFileSync ( 'tests/update_dependency_list/nuget.json' , 'utf-8' ) ) ;
298
- const rawPip = JSON . parse ( fs . readFileSync ( 'tests/update_dependency_list/pip.json' , 'utf-8' ) ) ;
299
- const raw = {
300
- [ 'repo1' ] : {
301
- [ 'pip' ] : rawPip [ 'data' ] ,
302
- [ 'nuget' ] : rawNuget [ 'data' ] ,
303
- } ,
304
- } ;
305
- const lists = DependabotStoredDependencyListsSchema . parse ( raw ) ;
306
-
307
- expect ( Object . keys ( lists ) ) . toEqual ( [ 'repo1' ] ) ;
308
- expect ( Object . keys ( lists [ 'repo1' ] ) ) . toEqual ( [ 'pip' , 'nuget' ] ) ;
309
-
310
- const data = lists [ 'repo1' ] [ 'nuget' ] ;
311
- expect ( data [ 'dependency_files' ] ) . toEqual ( [ '/Root.csproj' ] ) ;
312
- expect ( data [ 'dependencies' ] . length ) . toEqual ( 76 ) ;
313
-
314
- expect ( data [ 'dependencies' ] [ 0 ] . name ) . toEqual ( 'Azure.Core' ) ;
315
- expect ( data [ 'dependencies' ] [ 0 ] . version ) . toEqual ( '1.35.0' ) ;
316
- expect ( data [ 'dependencies' ] [ 0 ] . requirements . length ) . toEqual ( 0 ) ;
317
-
318
- expect ( data [ 'dependencies' ] [ 3 ] . name ) . toEqual ( 'GraphQL.Server.Ui.Voyager' ) ;
319
- expect ( data [ 'dependencies' ] [ 3 ] . version ) . toEqual ( '8.1.0' ) ;
320
- expect ( data [ 'dependencies' ] [ 3 ] . requirements . length ) . toEqual ( 1 ) ;
321
- expect ( data [ 'dependencies' ] [ 3 ] . requirements [ 0 ] . file ) . toEqual ( '/Root.csproj' ) ;
322
- expect ( data [ 'dependencies' ] [ 3 ] . requirements [ 0 ] . requirement ) . toEqual ( '8.1.0' ) ;
323
- expect ( data [ 'dependencies' ] [ 3 ] . requirements [ 0 ] . groups ) . toEqual ( [ 'dependencies' ] ) ;
324
-
325
- // TODO: this is about 10KB for one repo, two ecosystems, we should find a better way?
326
- expect ( JSON . stringify ( raw ) . length ) . toEqual ( 10_000 ) ;
327
- } ) ;
328
275
} ) ;
329
276
} ) ;
0 commit comments