backend: Update tests to replace expirationDate with autoDeletionDate for consistency
This commit is contained in:
parent
d2b0dd6f08
commit
ef514f752c
@ -26,12 +26,12 @@ describe('Room Request Validation Tests', () => {
|
||||
const response = await request(app)
|
||||
.post(`${baseUrl}${apiVersion}${endpoint}`)
|
||||
.send({
|
||||
expirationDate: 1772129829000
|
||||
autoDeletionDate: 1772129829000
|
||||
})
|
||||
.expect(200);
|
||||
|
||||
expect(response.body).toHaveProperty('creationDate');
|
||||
expect(response.body).toHaveProperty('expirationDate');
|
||||
expect(response.body).toHaveProperty('autoDeletionDate');
|
||||
expect(response.body).toHaveProperty('maxParticipants');
|
||||
expect(response.body).toHaveProperty('preferences');
|
||||
expect(response.body).toHaveProperty('moderatorRoomUrl');
|
||||
@ -44,7 +44,7 @@ describe('Room Request Validation Tests', () => {
|
||||
const response = await request(app)
|
||||
.post(`${baseUrl}${apiVersion}${endpoint}`)
|
||||
.send({
|
||||
expirationDate: 1772129829000,
|
||||
autoDeletionDate: 1772129829000,
|
||||
roomNamePrefix: 'Conference',
|
||||
maxParticipants: 10,
|
||||
preferences: {
|
||||
@ -56,7 +56,7 @@ describe('Room Request Validation Tests', () => {
|
||||
.expect(200);
|
||||
|
||||
expect(response.body).toHaveProperty('creationDate');
|
||||
expect(response.body).toHaveProperty('expirationDate');
|
||||
expect(response.body).toHaveProperty('autoDeletionDate');
|
||||
expect(response.body).toHaveProperty('maxParticipants');
|
||||
expect(response.body).toHaveProperty('preferences');
|
||||
expect(response.body).toHaveProperty('moderatorRoomUrl');
|
||||
@ -69,7 +69,7 @@ describe('Room Request Validation Tests', () => {
|
||||
const response = await request(app)
|
||||
.post(`${baseUrl}${apiVersion}${endpoint}`)
|
||||
.send({
|
||||
expirationDate: 1772129829000
|
||||
autoDeletionDate: 1772129829000
|
||||
})
|
||||
.expect(200);
|
||||
|
||||
@ -81,19 +81,19 @@ describe('Room Request Validation Tests', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('❌ Should return 422 when missing expirationDate', async () => {
|
||||
it('❌ Should return 422 when missing autoDeletionDate', async () => {
|
||||
const response = await request(app).post(`${baseUrl}${apiVersion}${endpoint}`).send({}).expect(422);
|
||||
|
||||
expect(response.body).toHaveProperty('error', 'Unprocessable Entity');
|
||||
expect(response.body.details[0].field).toBe('expirationDate');
|
||||
expect(response.body.details[0].field).toBe('autoDeletionDate');
|
||||
expect(response.body.details[0].message).toContain('Required');
|
||||
});
|
||||
|
||||
it('❌ Should return 422 when expirationDate is in the past', async () => {
|
||||
it('❌ Should return 422 when autoDeletionDate is in the past', async () => {
|
||||
const response = await request(app)
|
||||
.post(`${baseUrl}${apiVersion}${endpoint}`)
|
||||
.send({
|
||||
expirationDate: 1600000000000
|
||||
autoDeletionDate: 1600000000000
|
||||
})
|
||||
.expect(422);
|
||||
|
||||
@ -104,7 +104,7 @@ describe('Room Request Validation Tests', () => {
|
||||
const response = await request(app)
|
||||
.post(`${baseUrl}${apiVersion}${endpoint}`)
|
||||
.send({
|
||||
expirationDate: 1772129829000,
|
||||
autoDeletionDate: 1772129829000,
|
||||
maxParticipants: -5
|
||||
})
|
||||
.expect(422);
|
||||
@ -117,7 +117,7 @@ describe('Room Request Validation Tests', () => {
|
||||
const response = await request(app)
|
||||
.post(`${baseUrl}${apiVersion}${endpoint}`)
|
||||
.send({
|
||||
expirationDate: 1772129829000,
|
||||
autoDeletionDate: 1772129829000,
|
||||
maxParticipants: 'ten'
|
||||
})
|
||||
.expect(422);
|
||||
@ -125,11 +125,11 @@ describe('Room Request Validation Tests', () => {
|
||||
expect(response.body.details[0].message).toContain('Expected number, received string');
|
||||
});
|
||||
|
||||
it('❌ Should return 422 when expirationDate is not a number', async () => {
|
||||
it('❌ Should return 422 when autoDeletionDate is not a number', async () => {
|
||||
const response = await request(app)
|
||||
.post(`${baseUrl}${apiVersion}${endpoint}`)
|
||||
.send({
|
||||
expirationDate: 'tomorrow'
|
||||
autoDeletionDate: 'tomorrow'
|
||||
})
|
||||
.expect(422);
|
||||
|
||||
@ -140,7 +140,7 @@ describe('Room Request Validation Tests', () => {
|
||||
const response = await request(app)
|
||||
.post(`${baseUrl}${apiVersion}${endpoint}`)
|
||||
.send({
|
||||
expirationDate: 1772129829000,
|
||||
autoDeletionDate: 1772129829000,
|
||||
preferences: {
|
||||
recordingPreferences: { enabled: 'yes' },
|
||||
chatPreferences: { enabled: 'no' }
|
||||
@ -162,7 +162,7 @@ describe('Room Request Validation Tests', () => {
|
||||
mockLoggerService.error = jest.fn();
|
||||
|
||||
const response = await request(app).post(`${baseUrl}${apiVersion}${endpoint}`).send({
|
||||
expirationDate: 1772129829000,
|
||||
autoDeletionDate: 1772129829000,
|
||||
roomNamePrefix: 'OpenVidu'
|
||||
});
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ describe('OpenVidu Meet Room API Tests', () => {
|
||||
const response = await request(app)
|
||||
.post(`${baseUrl}${apiVersion}${endpoint}`)
|
||||
.send({
|
||||
expirationDate: 1772129829000,
|
||||
autoDeletionDate: 1772129829000,
|
||||
roomNamePrefix: 'OpenVidu',
|
||||
maxParticipants: 10,
|
||||
preferences: {
|
||||
@ -47,7 +47,7 @@ describe('OpenVidu Meet Room API Tests', () => {
|
||||
.expect(200);
|
||||
|
||||
expect(response.body).toHaveProperty('creationDate');
|
||||
expect(response.body).toHaveProperty('expirationDate');
|
||||
expect(response.body).toHaveProperty('autoDeletionDate');
|
||||
expect(response.body).toHaveProperty('maxParticipants');
|
||||
expect(response.body).toHaveProperty('preferences');
|
||||
expect(response.body).toHaveProperty('moderatorRoomUrl');
|
||||
@ -74,7 +74,7 @@ describe('OpenVidu Meet Room API Tests', () => {
|
||||
mockLoggerService.error = jest.fn();
|
||||
|
||||
const response = await request(app).post(`${baseUrl}${apiVersion}${endpoint}`).send({
|
||||
expirationDate: 1772129829000,
|
||||
autoDeletionDate: 1772129829000,
|
||||
roomNamePrefix: 'OpenVidu'
|
||||
});
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ describe('Participant API Security Tests', () => {
|
||||
|
||||
// Create a room and extract the roomId
|
||||
const response = await request(app).post(`${BASE_URL}/rooms`).set(API_KEY_HEADER, API_KEY).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
roomId = response.body.roomId;
|
||||
|
||||
@ -370,7 +370,7 @@ describe('Participant API Security Tests', () => {
|
||||
it('should fail when participant is moderator of a different room', async () => {
|
||||
// Create a new room to get a different roomId
|
||||
const roomResponse = await request(app).post(`${BASE_URL}/rooms`).set(API_KEY_HEADER, API_KEY).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
const newRoomId = roomResponse.body.roomId;
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ describe('Room API Security Tests', () => {
|
||||
|
||||
// Create a room and extract the roomId
|
||||
const response = await request(app).post(`${BASE_URL}/rooms`).set(API_KEY_HEADER, API_KEY).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
roomId = response.body.roomId;
|
||||
recordingId = `${roomId}--recordingId--uid`;
|
||||
@ -137,7 +137,7 @@ describe('Room API Security Tests', () => {
|
||||
it('should fail when participant is moderator of a different room', async () => {
|
||||
// Create a new room to get a different roomId
|
||||
const roomResponse = await request(app).post(`${BASE_URL}/rooms`).set(API_KEY_HEADER, API_KEY).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
const newRoomId = roomResponse.body.roomId;
|
||||
|
||||
@ -171,7 +171,7 @@ describe('Room API Security Tests', () => {
|
||||
it('should fail when participant is moderator of a different room', async () => {
|
||||
// Create a new room to get a different roomId
|
||||
const roomResponse = await request(app).post(`${BASE_URL}/rooms`).set(API_KEY_HEADER, API_KEY).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
const newRoomId = roomResponse.body.roomId;
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ describe('Room API Security Tests', () => {
|
||||
});
|
||||
|
||||
const response = await request(app).post(ROOMS_URL).set(API_KEY_HEADER, API_KEY).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
@ -101,7 +101,7 @@ describe('Room API Security Tests', () => {
|
||||
});
|
||||
|
||||
const response = await request(app).post(ROOMS_URL).set('Cookie', adminCookie).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
@ -112,7 +112,7 @@ describe('Room API Security Tests', () => {
|
||||
});
|
||||
|
||||
const response = await request(app).post(ROOMS_URL).set('Cookie', userCookie).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
expect(response.status).toBe(403);
|
||||
});
|
||||
@ -123,7 +123,7 @@ describe('Room API Security Tests', () => {
|
||||
});
|
||||
|
||||
const response = await request(app).post(ROOMS_URL).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
expect(response.status).toBe(401);
|
||||
});
|
||||
@ -135,7 +135,7 @@ describe('Room API Security Tests', () => {
|
||||
});
|
||||
|
||||
const response = await request(app).post(ROOMS_URL).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
@ -147,7 +147,7 @@ describe('Room API Security Tests', () => {
|
||||
});
|
||||
|
||||
const response = await request(app).post(ROOMS_URL).set('Cookie', userCookie).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
@ -159,7 +159,7 @@ describe('Room API Security Tests', () => {
|
||||
});
|
||||
|
||||
const response = await request(app).post(ROOMS_URL).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
expect(response.status).toBe(401);
|
||||
});
|
||||
@ -223,7 +223,7 @@ describe('Room API Security Tests', () => {
|
||||
beforeAll(async () => {
|
||||
// Create a room and extract the roomId to test the get room endpoint
|
||||
const response = await request(app).post(ROOMS_URL).set(API_KEY_HEADER, API_KEY).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
roomId = response.body.roomId;
|
||||
|
||||
@ -265,7 +265,7 @@ describe('Room API Security Tests', () => {
|
||||
it('should fail when participant is moderator of a different room', async () => {
|
||||
// Create a new room to get a different roomId
|
||||
const roomResponse = await request(app).post(ROOMS_URL).set(API_KEY_HEADER, API_KEY).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
const newRoomId = roomResponse.body.roomId;
|
||||
|
||||
@ -333,7 +333,7 @@ describe('Room API Security Tests', () => {
|
||||
beforeEach(async () => {
|
||||
// Create a room and extract the roomId to test the delete room endpoint
|
||||
const response = await request(app).post(ROOMS_URL).set(API_KEY_HEADER, API_KEY).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
roomId = response.body.roomId;
|
||||
});
|
||||
@ -388,7 +388,7 @@ describe('Room API Security Tests', () => {
|
||||
beforeAll(async () => {
|
||||
// Create a room and extract the roomId to test the get participant role endpoint
|
||||
const response = await request(app).post(ROOMS_URL).set(API_KEY_HEADER, API_KEY).send({
|
||||
expirationDate: EXPIRATION_DATE
|
||||
autoDeletionDate: EXPIRATION_DATE
|
||||
});
|
||||
roomId = response.body.roomId;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user