From cae55e0baaade80d86e82eb4026ce641593e5fa5 Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Sat, 19 Feb 2022 20:47:28 +0100 Subject: [PATCH] test: fix e2e test error codes As these were changed with the openapi decorator the test need to reflect this. Signed-off-by: Philip Molares --- test/private-api/auth.e2e-spec.ts | 4 ++-- test/private-api/history.e2e-spec.ts | 4 ++-- test/private-api/me.e2e-spec.ts | 4 ++-- test/private-api/register-and-login.e2e-spec.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/private-api/auth.e2e-spec.ts b/test/private-api/auth.e2e-spec.ts index a213888e7..236ae4dd9 100644 --- a/test/private-api/auth.e2e-spec.ts +++ b/test/private-api/auth.e2e-spec.ts @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ @@ -236,7 +236,7 @@ describe('Auth', () => { await request(testSetup.app.getHttpServer()) .delete('/api/private/auth/logout') .set('Cookie', cookie) - .expect(200); + .expect(204); }); }); }); diff --git a/test/private-api/history.e2e-spec.ts b/test/private-api/history.e2e-spec.ts index 32c76295e..1fe1c8af2 100644 --- a/test/private-api/history.e2e-spec.ts +++ b/test/private-api/history.e2e-spec.ts @@ -177,7 +177,7 @@ describe('History', () => { expect( (await testSetup.historyService.getEntriesByUser(user)).length, ).toEqual(1); - await agent.delete('/api/private/me/history').expect(200); + await agent.delete('/api/private/me/history').expect(204); expect( (await testSetup.historyService.getEntriesByUser(user)).length, ).toEqual(0); @@ -209,7 +209,7 @@ describe('History', () => { const entryDto = await historyService.toHistoryEntryDto(entry2); await agent .delete(`/api/private/me/history/${alias || 'undefined'}`) - .expect(200); + .expect(204); const userEntries = await historyService.getEntriesByUser(user); expect(userEntries.length).toEqual(1); const userEntryDto = await historyService.toHistoryEntryDto(userEntries[0]); diff --git a/test/private-api/me.e2e-spec.ts b/test/private-api/me.e2e-spec.ts index f044310f9..a4d42a66a 100644 --- a/test/private-api/me.e2e-spec.ts +++ b/test/private-api/me.e2e-spec.ts @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ @@ -96,7 +96,7 @@ describe('Me', () => { .send({ name: newDisplayName, }) - .expect(200); + .expect(201); const dbUser = await testSetup.userService.getUserByUsername('hardcoded'); expect(dbUser.displayName).toEqual(newDisplayName); }); diff --git a/test/private-api/register-and-login.e2e-spec.ts b/test/private-api/register-and-login.e2e-spec.ts index 4f49ccb0f..79b3fc1c4 100644 --- a/test/private-api/register-and-login.e2e-spec.ts +++ b/test/private-api/register-and-login.e2e-spec.ts @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ @@ -56,7 +56,7 @@ describe('Register and Login', () => { expect(profile.body.displayName).toEqual(DISPLAYNAME); // logout again - await session.delete('/api/private/auth/logout').expect(200); + await session.delete('/api/private/auth/logout').expect(204); // not allowed to request profile now await session.get('/api/private/me').expect(401);