Skip to content

Commit

Permalink
Fix code and add correspondingtest
Browse files Browse the repository at this point in the history
  • Loading branch information
vermakhushboo committed Nov 8, 2023
1 parent 9c6d1c3 commit 01ca4c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/VCS/Adapter/Git/GitHub.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function listRepositoryContents(string $owner, string $repositoryName, st

$response = $this->call(self::METHOD_GET, $url, ['Authorization' => "Bearer $this->accessToken"]);

if (!is_array($response['body'])) {
if (($response['headers']['status-code'] == 404)) {
return [];
}

Expand Down
7 changes: 7 additions & 0 deletions tests/Detector/DetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function setUp(): void

public function testLanguageDetection(): void
{
// test for SUCCESS
$languageMap = [
['vermakhushboo', 'basic-js-crud', 'node'],
['appwrite', 'appwrite', 'php'],
Expand All @@ -82,5 +83,11 @@ public function testLanguageDetection(): void
$runtime = $this->detect($files, $languages);
$this->assertEquals($expectedRuntime, $runtime);
}

// test for FAILURE
$files = $this->github->listRepositoryContents('', '');
$languages = $this->github->listRepositoryLanguages('', '');
$runtime = $this->detect($files, $languages);
$this->assertEquals(null, $runtime);
}
}

0 comments on commit 01ca4c2

Please sign in to comment.