@@ -68,13 +68,14 @@ func mockGetDocumentResponse(t *testing.T, sarifResponse sarif.SarifDocument, ex
6868 }, mockDeriveErrorFromStatusCode (responseCode ))
6969}
7070
71- func mockResultCompletedResponse (t * testing.T , mockHTTPClient * httpmocks.MockHTTPClient , expectedWebuilink string , projectId uuid.UUID , orgId string , testId uuid.UUID , documentPath string , responseCode int ) {
71+ func mockResultCompletedResponse (t * testing.T , mockHTTPClient * httpmocks.MockHTTPClient , expectedWebuilink string , projectId uuid.UUID , snapshotId uuid. UUID , orgId string , testId uuid.UUID , documentPath string , responseCode int ) {
7272 t .Helper ()
7373 response := v20241221 .NewTestResponse ()
7474 state := v20241221 .NewTestCompleteState ()
7575 state .Documents .EnrichedSarif = documentPath
7676 state .Results .Webui .Link = & expectedWebuilink
7777 state .Results .Webui .ProjectId = & projectId
78+ state .Results .Webui .SnapshotId = & snapshotId
7879 stateBytes , err := json .Marshal (state )
7980 assert .NoError (t , err )
8081 response .Data .Attributes .UnmarshalJSON (stateBytes )
@@ -150,6 +151,7 @@ func TestAnalysis_RunTest(t *testing.T) {
150151
151152 orgId := "4a72d1db-b465-4764-99e1-ecedad03b06a"
152153 projectId := uuid .New ()
154+ snapshotId := uuid .New ()
153155 testId := uuid .New ()
154156 report := true
155157 inputBundle := mocks2 .NewMockBundle (ctrl )
@@ -165,7 +167,7 @@ func TestAnalysis_RunTest(t *testing.T) {
165167 // Get Test Result Response
166168 expectedWebuilink := ""
167169 expectedDocumentPath := "/1234"
168- mockResultCompletedResponse (t , mockHTTPClient , expectedWebuilink , projectId , orgId , testId , expectedDocumentPath , http .StatusOK )
170+ mockResultCompletedResponse (t , mockHTTPClient , expectedWebuilink , projectId , snapshotId , orgId , testId , expectedDocumentPath , http .StatusOK )
169171
170172 // get document
171173 sarifResponse := sarif.SarifDocument {
@@ -197,6 +199,8 @@ func TestAnalysis_RunTest(t *testing.T) {
197199 assert .NotNil (t , result )
198200 assert .NotNil (t , resultMetadata )
199201 assert .Equal (t , expectedWebuilink , resultMetadata .WebUiUrl )
202+ assert .Equal (t , projectId .String (), resultMetadata .ProjectId )
203+ assert .Equal (t , snapshotId .String (), resultMetadata .SnapshotId )
200204 assert .Equal (t , sarifResponse .Version , result .Sarif .Version )
201205}
202206
@@ -207,6 +211,7 @@ func TestAnalysis_RunTestRemote(t *testing.T) {
207211
208212 orgId := "4a72d1db-b465-4764-99e1-ecedad03b06a"
209213 projectId := uuid .New ()
214+ snapshotId := uuid .New ()
210215 testId := uuid .New ()
211216 commitId := "abc123"
212217 report := true
@@ -217,7 +222,7 @@ func TestAnalysis_RunTestRemote(t *testing.T) {
217222 // Get Test Result Response
218223 expectedWebuilink := ""
219224 expectedDocumentPath := "/1234"
220- mockResultCompletedResponse (t , mockHTTPClient , expectedWebuilink , projectId , orgId , testId , expectedDocumentPath , http .StatusOK )
225+ mockResultCompletedResponse (t , mockHTTPClient , expectedWebuilink , projectId , snapshotId , orgId , testId , expectedDocumentPath , http .StatusOK )
221226
222227 // get document
223228 sarifResponse := sarif.SarifDocument {
@@ -249,6 +254,8 @@ func TestAnalysis_RunTestRemote(t *testing.T) {
249254 assert .NotNil (t , result )
250255 assert .NotNil (t , resultMetadata )
251256 assert .Equal (t , expectedWebuilink , resultMetadata .WebUiUrl )
257+ assert .Equal (t , projectId .String (), resultMetadata .ProjectId )
258+ assert .Equal (t , snapshotId .String (), resultMetadata .SnapshotId )
252259 assert .Equal (t , sarifResponse .Version , result .Sarif .Version )
253260}
254261
@@ -308,7 +315,7 @@ func TestAnalysis_RunTestRemote_PollingFailed(t *testing.T) {
308315 // Get Test Result Response
309316 expectedWebuilink := ""
310317 expectedDocumentPath := "/1234"
311- mockResultCompletedResponse (t , mockHTTPClient , expectedWebuilink , projectId , orgId , testId , expectedDocumentPath , http .StatusInternalServerError )
318+ mockResultCompletedResponse (t , mockHTTPClient , expectedWebuilink , projectId , uuid . New (), orgId , testId , expectedDocumentPath , http .StatusInternalServerError )
312319
313320 analysisOrchestrator := analysis .NewAnalysisOrchestrator (
314321 mockConfig ,
@@ -352,7 +359,7 @@ func TestAnalysis_RunTestRemote_GetDocumentFailed(t *testing.T) {
352359 // Get Test Result Response
353360 expectedWebuilink := ""
354361 expectedDocumentPath := "/1234"
355- mockResultCompletedResponse (t , mockHTTPClient , expectedWebuilink , projectId , orgId , testId , expectedDocumentPath , http .StatusOK )
362+ mockResultCompletedResponse (t , mockHTTPClient , expectedWebuilink , projectId , uuid . New (), orgId , testId , expectedDocumentPath , http .StatusOK )
356363
357364 // get document
358365 sarifResponse := sarif.SarifDocument {
0 commit comments