feat(core): Show Public API key value only once (no-changelog) (#10126)

This commit is contained in:
Ricardo Espinoza
2024-07-29 14:13:54 -04:00
committed by GitHub
parent de50ef7590
commit cf70b06545
7 changed files with 42 additions and 14 deletions

View File

@@ -175,14 +175,14 @@ describe('Owner shell', () => {
expect(storedShellOwner.apiKey).toEqual(response.body.data.apiKey);
});
test('GET /me/api-key should fetch the api key', async () => {
test('GET /me/api-key should fetch the api key redacted', async () => {
const response = await authOwnerShellAgent.get('/me/api-key');
expect(response.statusCode).toBe(200);
expect(response.body.data.apiKey).toEqual(ownerShell.apiKey);
expect(response.body.data.apiKey).not.toEqual(ownerShell.apiKey);
});
test('DELETE /me/api-key should fetch the api key', async () => {
test('DELETE /me/api-key should delete the api key', async () => {
const response = await authOwnerShellAgent.delete('/me/api-key');
expect(response.statusCode).toBe(200);
@@ -327,14 +327,14 @@ describe('Member', () => {
expect(storedMember.apiKey).toEqual(response.body.data.apiKey);
});
test('GET /me/api-key should fetch the api key', async () => {
test('GET /me/api-key should fetch the api key redacted', async () => {
const response = await testServer.authAgentFor(member).get('/me/api-key');
expect(response.statusCode).toBe(200);
expect(response.body.data.apiKey).toEqual(member.apiKey);
expect(response.body.data.apiKey).not.toEqual(member.apiKey);
});
test('DELETE /me/api-key should fetch the api key', async () => {
test('DELETE /me/api-key should delete the api key', async () => {
const response = await testServer.authAgentFor(member).delete('/me/api-key');
expect(response.statusCode).toBe(200);