fix: align auth success status contract

This commit is contained in:
2026-08-24 00:50:48 +03:00
parent c77b3cf782
commit 9bd3400264
3 changed files with 37 additions and 6 deletions
+13 -6
View File
@@ -34,7 +34,7 @@ describe('Authentication (e2e)', () => {
const registration = await agent
.post('/api/v1/auth/register')
.send({ email: ' User@Example.com ', password: 'a secure password' })
.expect(201);
.expect(200);
const authentication = registration.body as Authentication;
expect(authentication.user.email).toBe('user@example.com');
@@ -49,7 +49,7 @@ describe('Authentication (e2e)', () => {
);
const firstCookie = registration.headers['set-cookie'][0];
await agent.post('/api/v1/auth/refresh').expect(201);
await agent.post('/api/v1/auth/refresh').expect(200);
await request(app.getHttpServer())
.post('/api/v1/auth/refresh')
.set('Cookie', firstCookie)
@@ -63,7 +63,14 @@ describe('Authentication (e2e)', () => {
await request(app.getHttpServer())
.post('/api/v1/auth/register')
.send({ email: 'user@example.com', password: 'a secure password' })
.expect(201);
.expect(200);
await request(app.getHttpServer())
.post('/api/v1/auth/login')
.send({ email: 'user@example.com', password: 'a secure password' })
.expect(200)
.expect(({ body }: { body: unknown }) =>
expect((body as Authentication).user.email).toBe('user@example.com'),
);
await request(app.getHttpServer())
.post('/api/v1/auth/register')
.send({ email: 'USER@example.com', password: 'a secure password' })
@@ -84,7 +91,7 @@ describe('Authentication (e2e)', () => {
const registration = await request(app.getHttpServer())
.post('/api/v1/auth/register')
.send({ email: 'connection@example.com', password: 'a secure password' })
.expect(201);
.expect(200);
const accessToken = (registration.body as Authentication).accessToken;
await request(app.getHttpServer())
@@ -103,7 +110,7 @@ describe('Authentication (e2e)', () => {
const registration = await request(app.getHttpServer())
.post('/api/v1/auth/register')
.send({ email: 'accounts@example.com', password: 'a secure password' })
.expect(201);
.expect(200);
const accessToken = (registration.body as Authentication).accessToken;
await request(app.getHttpServer())
@@ -122,7 +129,7 @@ describe('Authentication (e2e)', () => {
const registration = await request(app.getHttpServer())
.post('/api/v1/auth/register')
.send({ email: 'portfolio@example.com', password: 'a secure password' })
.expect(201);
.expect(200);
const accessToken = (registration.body as Authentication).accessToken;
await request(app.getHttpServer())