From f20c2f06e065599665cc81a8099db7f49e089e22 Mon Sep 17 00:00:00 2001
From: David Mehren <git@herrmehren.de>
Date: Wed, 24 Feb 2021 21:14:16 +0100
Subject: [PATCH] Fix various ESLint errors in E2E tests

Signed-off-by: David Mehren <git@herrmehren.de>
---
 test/public-api/me.e2e-spec.ts    | 11 ++++++++---
 test/public-api/media.e2e-spec.ts |  7 ++++++-
 test/public-api/notes.e2e-spec.ts |  9 +++++++--
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/test/public-api/me.e2e-spec.ts b/test/public-api/me.e2e-spec.ts
index 42f73c940..aa4733080 100644
--- a/test/public-api/me.e2e-spec.ts
+++ b/test/public-api/me.e2e-spec.ts
@@ -4,6 +4,11 @@
  * SPDX-License-Identifier: AGPL-3.0-only
  */
 
+/* eslint-disable
+@typescript-eslint/no-unsafe-assignment,
+@typescript-eslint/no-unsafe-member-access
+*/
+
 import { INestApplication } from '@nestjs/common';
 import { Test } from '@nestjs/testing';
 import * as request from 'supertest';
@@ -94,7 +99,7 @@ describe('Notes', () => {
       .expect(200);
     const history = <HistoryEntryDto[]>response.body;
     for (const historyEntry of history) {
-      if ((<HistoryEntryDto>historyEntry).identifier === 'testGetHistory') {
+      if (historyEntry.identifier === 'testGetHistory') {
         expect(historyEntry).toEqual(createdHistoryEntry);
       }
     }
@@ -116,7 +121,7 @@ describe('Notes', () => {
     historyEntry = null;
     for (const e of history) {
       if (e.note.alias === noteName) {
-        historyEntry = await historyService.toHistoryEntryDto(e);
+        historyEntry = historyService.toHistoryEntryDto(e);
       }
     }
     expect(historyEntry.pinStatus).toEqual(true);
@@ -133,7 +138,7 @@ describe('Notes', () => {
     const history = await historyService.getEntriesByUser(user);
     let historyEntry: HistoryEntry = null;
     for (const e of history) {
-      if ((<HistoryEntry>e).note.alias === noteName) {
+      if (e.note.alias === noteName) {
         historyEntry = e;
       }
     }
diff --git a/test/public-api/media.e2e-spec.ts b/test/public-api/media.e2e-spec.ts
index f2a1cf8bd..89843b1cf 100644
--- a/test/public-api/media.e2e-spec.ts
+++ b/test/public-api/media.e2e-spec.ts
@@ -4,6 +4,11 @@
  * SPDX-License-Identifier: AGPL-3.0-only
  */
 
+/* eslint-disable
+@typescript-eslint/no-unsafe-assignment,
+@typescript-eslint/no-unsafe-member-access
+*/
+
 import { ConfigModule, ConfigService } from '@nestjs/config';
 import { NestExpressApplication } from '@nestjs/platform-express';
 import { Test } from '@nestjs/testing';
@@ -78,7 +83,7 @@ describe('Notes', () => {
       .set('HedgeDoc-Note', 'test_upload_media')
       .expect('Content-Type', /json/)
       .expect(201);
-    const path = uploadResponse.body.link;
+    const path: string = uploadResponse.body.link;
     const testImage = await fs.readFile('test/public-api/fixtures/test.png');
     const downloadResponse = await request(app.getHttpServer()).get(path);
     expect(downloadResponse.body).toEqual(testImage);
diff --git a/test/public-api/notes.e2e-spec.ts b/test/public-api/notes.e2e-spec.ts
index f201f3d67..4aaa18ef1 100644
--- a/test/public-api/notes.e2e-spec.ts
+++ b/test/public-api/notes.e2e-spec.ts
@@ -4,6 +4,11 @@
  * SPDX-License-Identifier: AGPL-3.0-only
  */
 
+/* eslint-disable
+@typescript-eslint/no-unsafe-assignment,
+@typescript-eslint/no-unsafe-member-access
+*/
+
 import { INestApplication } from '@nestjs/common';
 import { ConfigModule } from '@nestjs/config';
 import { Test } from '@nestjs/testing';
@@ -149,7 +154,7 @@ describe('Notes', () => {
         .set('Content-Type', 'text/markdown')
         .send(changedContent)
         .expect(200);
-      await expect(
+      expect(
         await notesService.getNoteContent(
           await notesService.getNoteByIdOrAlias('test4'),
         ),
@@ -239,7 +244,7 @@ describe('Notes', () => {
       const note = await notesService.createNote(content, 'test7', user);
       const revision = await notesService.getLatestRevision(note);
       const response = await request(app.getHttpServer())
-        .get('/notes/test7/revisions/' + revision.id)
+        .get(`/notes/test7/revisions/${revision.id}`)
         .expect('Content-Type', /json/)
         .expect(200);
       expect(response.body.content).toEqual(content);