209 похожих чатов

Дяденьки Как отличить e2e тест модуля от е2е теста контроллера? — Вот например

тест, который по умолчанию генерится в нест-приложении.
Название его app.e2e
Но по виду, он просто тестит контроллер:
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { AppModule } from '../src/app.module';

describe('AppController (e2e)', () => {
let app: INestApplication;

beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
}).compile();

app = moduleFixture.createNestApplication();
await app.init();
});

it('/ (GET)', () => {
return request(app.getHttpServer())
.get('/')
.expect(200)
.expect((res) => {
if (
!res.text.startsWith(
'<h3 style="color:green"> Вы зашли на запущенный сервер </h3><hr>',
)
) {
throw new Error('Unexpected response');
}
});
});
});

2 ответов

8 просмотров

Супер тест всегда про е2е

Ayrat- Автор вопроса
IL'shat Khamitov
Супер тест всегда про е2е

есть ли разница в названии (типе) теста, когда я - тестирую контроллер на реальных данных из БД (настоящий accountId, например) и - тестирую тот же контроллер, но подсовываю вместо реальных данных заглушки? ..при этом в обоих случаях используется Supertest.

Похожие вопросы

Обсуждают сегодня

I arrived here after a Chico Crypto show highlighted the project & the Team - the fact that the Team had a long history of successfully working with household names gave me e...
Banter is Bullish
1
Is it a good price to buy hex now on 0,0019?
Patrick
29
It's unfortunate that the "Then why are you here" or "lol you must've bought high" mantras always come up. I already tried bringing up this subject in the price channel but si...
Leroy Gerrits
4
Lers say somehow tor got shut down What then?
Mark Keller
15
Are there any empirical studies out there about how probable and how much it costs to double spend BCH?
Joemar Taganna
11
Hey everyone how's it going? I messaged in dev chat the other day. I got some good reactions but never got through to a team member. I work for a cross-chain interoperability ...
Jake | BD CryptoLink.Tech
5
Gm, Oceaners🌟 We're going to #DappCon24 🇩🇪 between May 21-23 in Berlin to talk #blockchain future! If you're nearby, come by and say hello at our booth! Grab your tickets h...
KreigDK | Never DM first🌊
8
💧 Introducing Drip 💧 We’re thrilled to announce that after a successful month-long testing phase by our OG members on Discord, Drip is now rolling out to the entire community!...
Robin (will not DM first)
1
Jared Tate say DGB can fix 95% of cybersecurity vulnerability on internet today. This true admin? He say at 9 minute 30 second of video
Positif Vibes
11
What is the goal of Digibyte & how will we give it global appeal/ make everyday ppl want to hold it?
Valentenio x10
12
Карта сайта