From ff2dce1692732411e369a153c0886b02ee8cd844 Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Sun, 20 Apr 2025 01:27:54 +0200 Subject: [PATCH] test(backend): remove app.e2e-spec as it is unnecessary This test is unnecessary since it does not use the shared app-init which is used to set up tests and the real main app. Signed-off-by: Erik Michelson --- backend/test/app.e2e-spec.ts | 60 ------------------------------------ 1 file changed, 60 deletions(-) delete mode 100644 backend/test/app.e2e-spec.ts diff --git a/backend/test/app.e2e-spec.ts b/backend/test/app.e2e-spec.ts deleted file mode 100644 index cb429387d..000000000 --- a/backend/test/app.e2e-spec.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) - * - * SPDX-License-Identifier: AGPL-3.0-only - */ -import { getConfigToken } from '@nestjs/config'; -import { WsAdapter } from '@nestjs/platform-ws'; -import { Test } from '@nestjs/testing'; -import request from 'supertest'; - -import { AppModule } from '../src/app.module'; -import { BackendType } from '../src/media/backends/backend-type.enum'; - -describe('App', () => { - it('should not crash on requests to /', async () => { - const moduleRef = await Test.createTestingModule({ - imports: [AppModule], - }) - .overrideProvider(getConfigToken('appConfig')) - .useValue({ - baseUrl: 'localhost', - port: 3333, - }) - .overrideProvider(getConfigToken('mediaConfig')) - .useValue({ - backend: { - use: BackendType.FILESYSTEM, - filesystem: { - uploadPath: - 'test_uploads' + Math.floor(Math.random() * 100000).toString(), - }, - }, - }) - .overrideProvider(getConfigToken('databaseConfig')) - .useValue({ - database: ':memory:', - type: 'sqlite', - }) - .overrideProvider(getConfigToken('authConfig')) - .useValue({ - session: { - secret: 'secret', - }, - oidc: [], - }) - .compile(); - - /** - * TODO: This is not really a regression test, as it does not use the - * real initialization code in main.ts. - * Should be fixed after https://github.com/hedgedoc/hedgedoc/issues/2083 - * is done. - */ - const app = moduleRef.createNestApplication(); - app.useWebSocketAdapter(new WsAdapter(app)); - await app.init(); - await request(app.getHttpServer()).get('/').expect(404); - await app.close(); - }); -});