@@ -21,7 +21,7 @@ func TestDependencyGraphService_CreateSnapshot(t *testing.T) {
21
21
22
22
mux .HandleFunc ("/repos/o/r/dependency-graph/snapshots" , func (w http.ResponseWriter , r * http.Request ) {
23
23
testMethod (t , r , "POST" )
24
- testBody (
t ,
r ,
`{"version":0,"sha":"ce587453ced02b1526dfb4cb910479d431683101","ref":"refs/heads/main","job":{"correlator":"yourworkflowname_youractionname","id":"yourrunid","html_url":"https://example.com"},"detector":{"name":"octo-detector","version":"0.0.1","url":"https://github.com/octo-org/octo-repo"},"scanned":"2022-06-14T20:25:00Z","metadata":{"key1":"value1","key2":"value2"},"manifests":{"package-lock.json":{"name":"package-lock.json","file":{"source_location":"src/package-lock.json"},"resolved":{"@actions/core":{"package_url":"pkg:/npm/%40actions/[email protected] ","relationship":"direct","scope":"runtime","dependencies":["@actions/http-client"]},"@actions/http-client":{"package_url":"pkg:/npm/%40actions/[email protected] ","relationship":"indirect","scope":"runtime","dependencies":["tunnel"]},"tunnel":{"package_url":"pkg:/npm/[email protected] ","relationship":"indirect","scope":"runtime"}}}}}` + "\n " )
24
+ testBody (
t ,
r ,
`{"version":0,"sha":"ce587453ced02b1526dfb4cb910479d431683101","ref":"refs/heads/main","job":{"correlator":"yourworkflowname_youractionname","id":"yourrunid","html_url":"https://example.com"},"detector":{"name":"octo-detector","version":"0.0.1","url":"https://github.com/octo-org/octo-repo"},"scanned":"2022-06-14T20:25:00Z","metadata":{"key1":"value1","key2":"value2"},"manifests":{"package-lock.json":{"name":"package-lock.json","file":{"source_location":"src/package-lock.json"},"metadata":{"key1":"value1","key2":"value2"}," resolved":{"@actions/core":{"package_url":"pkg:/npm/%40actions/[email protected] ","metadata":{"licenses":"MIT"} ,"relationship":"direct","scope":"runtime","dependencies":["@actions/http-client"]},"@actions/http-client":{"package_url":"pkg:/npm/%40actions/[email protected] ","relationship":"indirect","scope":"runtime","dependencies":["tunnel"]},"tunnel":{"package_url":"pkg:/npm/[email protected] ","relationship":"indirect","scope":"runtime"}}}}}` + "\n " )
25
25
fmt .Fprint (w , `{"id":12345,"created_at":"2022-06-14T20:25:01Z","message":"Dependency results for the repo have been successfully updated.","result":"SUCCESS"}` )
26
26
})
27
27
@@ -49,11 +49,18 @@ func TestDependencyGraphService_CreateSnapshot(t *testing.T) {
49
49
"package-lock.json" : {
50
50
Name : Ptr ("package-lock.json" ),
51
51
File : & DependencyGraphSnapshotManifestFile {SourceLocation : Ptr ("src/package-lock.json" )},
52
+ Metadata : map [string ]any {
53
+ "key1" : "value1" ,
54
+ "key2" : "value2" ,
55
+ },
52
56
Resolved : map [string ]* DependencyGraphSnapshotResolvedDependency {
53
57
"@actions/core" : {
54
58
PackageURL :
Ptr (
"pkg:/npm/%40actions/[email protected] " ),
55
59
Relationship : Ptr ("direct" ),
56
60
Scope : Ptr ("runtime" ),
61
+ Metadata : map [string ]any {
62
+ "licenses" : "MIT" ,
63
+ },
57
64
Dependencies : []string {"@actions/http-client" },
58
65
},
59
66
"@actions/http-client" : {
0 commit comments