Skip to content

Commit 2803e5f

Browse files
fix(home): align error tests with graceful GitHub API fallback
Tests now expect 200 with empty data when GitHub API fails, matching the service's catch-and-return-empty-array behavior.
1 parent f8bf9ca commit 2803e5f

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

modules/home/tests/home.integration.tests.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,20 @@ describe('Home integration tests:', () => {
9191
}
9292
});
9393

94-
test('should return 422 when GitHub API fails for releases', async () => {
94+
test('should return empty releases gracefully when GitHub API fails', async () => {
9595
axios.get.mockRejectedValueOnce(new Error('GitHub API unavailable'));
96-
const result = await agent.get('/api/home/releases').expect(422);
97-
expect(result.body.type).toBe('error');
98-
expect(result.body.message).toBe('Unprocessable Entity');
99-
expect(result.body.description).toBe('GitHub API unavailable.');
96+
const result = await agent.get('/api/home/releases').expect(200);
97+
expect(result.body.type).toBe('success');
98+
expect(result.body.message).toBe('releases');
99+
expect(result.body.data).toEqual([]);
100100
});
101101

102-
test('should return 422 when GitHub API fails for changelogs', async () => {
102+
test('should return empty changelogs gracefully when GitHub API fails', async () => {
103103
axios.get.mockRejectedValueOnce(new Error('GitHub API unavailable'));
104-
const result = await agent.get('/api/home/changelogs').expect(422);
105-
expect(result.body.type).toBe('error');
106-
expect(result.body.message).toBe('Unprocessable Entity');
107-
expect(result.body.description).toBe('GitHub API unavailable.');
104+
const result = await agent.get('/api/home/changelogs').expect(200);
105+
expect(result.body.type).toBe('success');
106+
expect(result.body.message).toBe('changelogs');
107+
expect(result.body.data).toEqual([]);
108108
});
109109

110110
test('should use Authorization header when a token is configured for releases', async () => {

0 commit comments

Comments
 (0)