Skip to content

Commit

Permalink
Test for /verify added to gatewayservice tests
Browse files Browse the repository at this point in the history
  • Loading branch information
UO287687 committed Apr 7, 2024
1 parent e33819b commit 6c3ea46
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions gatewayservice/gateway-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ describe('Gateway Service', () => {
}
]
});
}else if(url.endsWith('/verify')){
return Promise.resolve({ data: { username: 'testuser' } });
}
});
// Test /health endpoint
Expand All @@ -85,6 +87,14 @@ describe('Gateway Service', () => {
expect(response.statusCode).toBe(200);
expect(response.body.token).toBe('mockedToken');
});
// Test /verify endpoint
it('should verify authorization token with auth service', async () => {
const response = await request(app)
.get('/verify')
.set('Authorization', 'Bearer mockedToken');
expect(response.statusCode).toBe(200);
expect(response.body).toHaveProperty('username', 'testuser');
});

// Test /adduser endpoint
it('should forward add user request to user service', async () => {
Expand Down

0 comments on commit 6c3ea46

Please sign in to comment.