@@ -187,6 +187,59 @@ class GitHubScanningServiceTest {
187187 verify { syncLogService.sendInfoLog(" Finished full scan for all available organizations." ) }
188188 }
189189
190+ @Test
191+ fun `scanGitHubResources should not send repositories and manifest files over WebSocket for archived repos` () {
192+ // given
193+ every { cachingService.get(" runId" ) } returns runId
194+ every { gitHubGraphQLService.getRepositories(any(), any()) } returns PagedRepositories (
195+ repositories = listOf (
196+ RepositoryDto (
197+ id = " repo1" ,
198+ name = " TestRepo" ,
199+ organizationName = " testOrg" ,
200+ description = " A test repository" ,
201+ url = " https://github.com/testRepo" ,
202+ defaultBranch = " main" ,
203+ archived = true ,
204+ visibility = RepositoryVisibility .PUBLIC ,
205+ updatedAt = " 2024-01-01T00:00:00Z" ,
206+ languages = listOf (" Kotlin" , " Java" ),
207+ topics = listOf (" test" , " example" ),
208+ )
209+ ),
210+ hasNextPage = false ,
211+ cursor = null
212+ )
213+ every { gitHubClient.searchManifestFiles(any(), any()) } returns GitHubSearchResponse (
214+ 1 ,
215+ listOf (
216+ ItemResponse (
217+ name = " leanix.yaml" ,
218+ path = " dir/leanix.yaml" ,
219+ repository = RepositoryItemResponse (
220+ name = " TestRepo" ,
221+ fullName = " testOrg/TestRepo"
222+ ),
223+ url = " http://url"
224+ )
225+ )
226+ )
227+ every { gitHubGraphQLService.getManifestFileContent(any(), any(), " dir/leanix.yaml" , any()) } returns " content"
228+
229+ // when
230+ gitHubScanningService.scanGitHubResources()
231+
232+ // then
233+ verify(exactly = 0 ) { webSocketService.sendMessage(eq(" $runId /manifestFiles" ), any()) }
234+ verify(exactly = 0 ) { syncLogService.sendInfoLog(" Scanning repository TestRepo for manifest files." ) }
235+ verify(
236+ exactly = 0
237+ ) { syncLogService.sendInfoLog(" Fetched manifest file 'dir/leanix.yaml' from repository 'TestRepo'." ) }
238+ verify(exactly = 0 ) { syncLogService.sendInfoLog(" Found 1 manifest files in repository TestRepo." ) }
239+ verify { syncLogService.sendInfoLog(" Finished initial full scan for organization testInstallation." ) }
240+ verify { syncLogService.sendInfoLog(" Finished full scan for all available organizations." ) }
241+ }
242+
190243 @Test
191244 fun `scanGitHubResources should send manifest files with empty path if the file is in the root directory` () {
192245 // given
0 commit comments