From 88fe8af17647a59f00d010baf77be0d3b5a8d0b5 Mon Sep 17 00:00:00 2001 From: Jorgenettodev Date: Thu, 21 Nov 2024 05:42:47 -0300 Subject: [PATCH 1/6] test(testimonies): implementa teste unitario para buscar testimonies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Garante que a service consegue buscar e atualizar testimonies com informações do mentor - Valida interações e transformações de dados com o repository - Cobre funcionalidades core como buscar e enriquecer os testimonies --- .../services/createTestimony.spec.ts | 129 +++++++++++++++- .../__tests__/services/getTestimonies.spec.ts | 146 +++++++++++++++++- 2 files changed, 271 insertions(+), 4 deletions(-) diff --git a/src/modules/testimony/__tests__/services/createTestimony.spec.ts b/src/modules/testimony/__tests__/services/createTestimony.spec.ts index 2ada8b7..d891182 100644 --- a/src/modules/testimony/__tests__/services/createTestimony.spec.ts +++ b/src/modules/testimony/__tests__/services/createTestimony.spec.ts @@ -1,6 +1,131 @@ import { Test, TestingModule } from '@nestjs/testing'; import { CreateTestimonyService } from '../../services/createTestimony.service'; +import { TestimonyRepository } from '../../repository/testimony.repository'; +import { CreateTestimonyDto } from '../../dto/create-testimony.dto'; +import { MentorEntity } from 'src/modules/mentors/entities/mentor.entity'; -describe('Create Testimony Tests', () => { +describe('CreateTestimonyService', () => { + let service: CreateTestimonyService; + let testimonyRepository: TestimonyRepository; -}); \ No newline at end of file + beforeEach(async () => { + // Create mock repository + const mockTestimonyRepository = { + createNewTestimony: jest.fn(), + } as Partial>; + + // Create testing module + const module: TestingModule = await Test.createTestingModule({ + providers: [ + CreateTestimonyService, + { + provide: TestimonyRepository, + useValue: mockTestimonyRepository, + }, + ], + }).compile(); + + // Get service and repository instances + service = module.get(CreateTestimonyService); + testimonyRepository = module.get(TestimonyRepository); + }); + + // Test successful testimony creation + it('should create a testimony with mentor data', async () => { + // Arrange: Prepare test data + const mentorData: MentorEntity = { + id: 'mentor1', + fullName: 'John Doe', + profile: 'http://example.com/profile.jpg', + specialties: ['JavaScript', 'React'], + dateOfBirth: new Date(), + password: 'password', + email: 'john@example.com', + role: 'mentor', + createdAt: new Date(), + updatedAt: new Date(), + gender: 'Male', + aboutMe: 'Test mentor', + }; + + const createTestimonyDto: CreateTestimonyDto = { + description: 'Test testimony description', + userName: mentorData.fullName, + role: mentorData.specialties.join(','), + imageUrl: mentorData.profile, + }; + + // Spy on repository method + jest + .spyOn(testimonyRepository, 'createNewTestimony') + .mockResolvedValue(undefined); + + // Act: Execute the service method + const result = await service.execute(createTestimonyDto, mentorData); + + // Assert: Verify the expected behavior + expect(testimonyRepository.createNewTestimony).toHaveBeenCalledWith( + { + ...createTestimonyDto, + userName: mentorData.fullName, + role: 'JavaScript,React', + imageUrl: mentorData.profile, + }, + mentorData.id, + ); + + expect(result).toEqual({ + message: 'Testimony created successfully', + }); + }); + + // Test error handling + it('should handle errors during testimony creation', async () => { + // Arrange + const createTestimonyDto: CreateTestimonyDto = { + description: 'Test testimony description', + userName: '', + role: '', + imageUrl: '', + }; + + const mentorData: MentorEntity = { + id: 'mentor1', + fullName: 'John Doe', + profile: 'http://example.com/profile.jpg', + specialties: ['JavaScript', 'React'], + // Add other required mentor properties + dateOfBirth: new Date(), + password: 'password', + email: 'john@example.com', + role: 'mentor', + createdAt: new Date(), + updatedAt: new Date(), + gender: 'Male', + aboutMe: 'Test mentor', + }; + + // Simulate repository error + const mockError = new Error('Repository creation failed'); + jest + .spyOn(testimonyRepository, 'createNewTestimony') + .mockRejectedValue(mockError); + + // Use console.log spy to verify error logging + const consoleSpy = jest.spyOn(console, 'log'); + + // Act & Assert + const result = await service.execute(createTestimonyDto, mentorData); + + // Verify error was logged + expect(consoleSpy).toHaveBeenCalledWith(mockError); + + // Verify result is still returned + expect(result).toEqual({ + message: 'Testimony created successfully', + }); + + // Clean up + consoleSpy.mockRestore(); + }); +}); diff --git a/src/modules/testimony/__tests__/services/getTestimonies.spec.ts b/src/modules/testimony/__tests__/services/getTestimonies.spec.ts index ab14814..38a4165 100644 --- a/src/modules/testimony/__tests__/services/getTestimonies.spec.ts +++ b/src/modules/testimony/__tests__/services/getTestimonies.spec.ts @@ -1,6 +1,148 @@ import { Test, TestingModule } from '@nestjs/testing'; import { GetAllTestimoniesService } from '../../services/getTestimonies.service'; +import { TestimonyEntity } from '../../entity/testimony.entity'; +import { TestimonyRepository } from '../../repository/testimony.repository'; +import { MentorRepository } from 'src/modules/mentors/repository/mentor.repository'; +import { MentorEntity } from 'src/modules/mentors/entities/mentor.entity'; -describe('Get Testimonies Tests', () => { +describe('GetAllTestimoniesService', () => { + // Inicializa o mocka das dependencias + let service: GetAllTestimoniesService; + let testimonyRepository: TestimonyRepository; + let mentorRepository: MentorRepository; -}); \ No newline at end of file + beforeEach(async () => { + // cria mock repositories para o Testimony e para o Mentors + const mockTestimonyRepository = { + findAlltestimony: jest.fn(), + editTestimony: jest.fn(), + } as Partial>; + + const mockMentorRepository = { + findAllMentors: jest.fn(), + } as Partial>; + + // modulo de testes + const module: TestingModule = await Test.createTestingModule({ + providers: [ + GetAllTestimoniesService, + { + provide: TestimonyRepository, + useValue: mockTestimonyRepository, + }, + { + provide: MentorRepository, + useValue: mockMentorRepository, + }, + ], + }).compile(); + + // Instancia as dependências + service = module.get(GetAllTestimoniesService); + testimonyRepository = module.get(TestimonyRepository); + mentorRepository = module.get(MentorRepository); + }); + + // test # 1 -> Pegar todas as testimonies, verifica se bate com o id do mentor, atualiza + // a testimony com a info do mentor, retorna a testimony atualizada. + + it('should retrieve and update testimonies with mentor information', async () => { + // Arrange + const mockTestimonies: TestimonyEntity[] = [ + { + id: '1', + mentor_id: 'mentor1', + imageUrl: '', + role: '', + userName: '', + description: 'Testimony description', + }, + ]; + + const mockMentors: MentorEntity[] = [ + { + id: 'mentor1', + fullName: 'John Doe', + profile: 'profile-url', + specialties: ['JavaScript', 'React'], + dateOfBirth: new Date(), + password: 'password', + email: 'john.doe@example.com', + role: 'mentor', + createdAt: new Date(), + updatedAt: new Date(), + gender: 'Male', + aboutMe: 'A great Mentor', + }, + ]; + + jest + .spyOn(testimonyRepository, 'findAlltestimony') + .mockResolvedValue(mockTestimonies); + + jest + .spyOn(mentorRepository, 'findAllMentors') + .mockResolvedValue(mockMentors); + + jest + .spyOn(testimonyRepository, 'editTestimony') + .mockResolvedValue(undefined); + + // Act + const result = await service.execute(); + + // Assert + expect(testimonyRepository.findAlltestimony).toHaveBeenCalled(); + expect(mentorRepository.findAllMentors).toHaveBeenCalled(); + expect(testimonyRepository.editTestimony).toHaveBeenCalledWith('1', { + id: '1', + mentor_id: 'mentor1', + imageUrl: 'profile-url', + role: 'JavaScript,React', + userName: 'John Doe', + description: 'Testimony description', + }); + expect(result).toEqual([ + { + id: '1', + mentor_id: 'mentor1', + imageUrl: 'profile-url', + role: 'JavaScript,React', + userName: 'John Doe', + description: 'Testimony description', + }, + ]); + }); +}); + +// TESTE ANTIGOS +// describe('Get Testimonies Tests', () => { +// // variavel de servico, do tipo servico +// let service: GetAllTestimoniesService; +// let testimonyRepository: jest.Mocked + +// // vai rodar antes de cada teste +// beforeEach(() => { +// service = { +// execute: jest.fn(), +// } as any; +// }); + +// describe('execute', () => { +// it('should run the service', async () => { +// const testimonies: TestimonyEntity[] = [ +// { +// userName: 'teste', +// role: 'teste role', +// description: 'teste description', +// }, +// ]; + +// jest.spyOn(service, 'execute').mockResolvedValue(testimonies); +// const result = await service.execute(); + +// // espera-se que o resultado seja igual a lista de testimonies. +// expect(result).toEqual(testimonies); +// }); +// }); +// }); From 01df566f0b7f56e5e8b8d24d029d6d1f61f5bd67 Mon Sep 17 00:00:00 2001 From: Jorgenettodev Date: Thu, 21 Nov 2024 05:53:10 -0300 Subject: [PATCH 2/6] test(testimony): Adiciona testes unitarios para CreateTestimonyService MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Implementa cenários detalhados de teste para criação de testimonies - Verifica o comportamento da service com transformacao de dados do mentor - Cobre criacao, error handling - Garante interacao com repository --- .../__tests__/services/createTestimony.spec.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/modules/testimony/__tests__/services/createTestimony.spec.ts b/src/modules/testimony/__tests__/services/createTestimony.spec.ts index d891182..a701794 100644 --- a/src/modules/testimony/__tests__/services/createTestimony.spec.ts +++ b/src/modules/testimony/__tests__/services/createTestimony.spec.ts @@ -9,12 +9,12 @@ describe('CreateTestimonyService', () => { let testimonyRepository: TestimonyRepository; beforeEach(async () => { - // Create mock repository + // Cria mock repository const mockTestimonyRepository = { createNewTestimony: jest.fn(), } as Partial>; - // Create testing module + // Cria testing module const module: TestingModule = await Test.createTestingModule({ providers: [ CreateTestimonyService, @@ -25,12 +25,12 @@ describe('CreateTestimonyService', () => { ], }).compile(); - // Get service and repository instances + // Pega instancia do service e do repository service = module.get(CreateTestimonyService); testimonyRepository = module.get(TestimonyRepository); }); - // Test successful testimony creation + // Testa criacao bem sucedida de testimony. it('should create a testimony with mentor data', async () => { // Arrange: Prepare test data const mentorData: MentorEntity = { @@ -60,10 +60,10 @@ describe('CreateTestimonyService', () => { .spyOn(testimonyRepository, 'createNewTestimony') .mockResolvedValue(undefined); - // Act: Execute the service method + // Act: Executa o método da service const result = await service.execute(createTestimonyDto, mentorData); - // Assert: Verify the expected behavior + // Assert: Verifica comportamento esperado expect(testimonyRepository.createNewTestimony).toHaveBeenCalledWith( { ...createTestimonyDto, @@ -94,7 +94,6 @@ describe('CreateTestimonyService', () => { fullName: 'John Doe', profile: 'http://example.com/profile.jpg', specialties: ['JavaScript', 'React'], - // Add other required mentor properties dateOfBirth: new Date(), password: 'password', email: 'john@example.com', @@ -105,7 +104,7 @@ describe('CreateTestimonyService', () => { aboutMe: 'Test mentor', }; - // Simulate repository error + // Simula erro no repository const mockError = new Error('Repository creation failed'); jest .spyOn(testimonyRepository, 'createNewTestimony') From 8e3438b5a7cc2e1bab5561bfb788728207cd8b92 Mon Sep 17 00:00:00 2001 From: Jorgenettodev Date: Thu, 21 Nov 2024 06:09:13 -0300 Subject: [PATCH 3/6] test(testimonies): adiciona test unitario para DeteleTestimonyService MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Implementa cenários de teste para deletar testimony - Verifica deleção bem sucedida de testimony - Testa error handling para testimony não existente - Adiciona teste para error handling --- .../services/deleteTestimony.spec.ts | 133 +++++++++++++++++- 1 file changed, 131 insertions(+), 2 deletions(-) diff --git a/src/modules/testimony/__tests__/services/deleteTestimony.spec.ts b/src/modules/testimony/__tests__/services/deleteTestimony.spec.ts index aa2e7a2..4569325 100644 --- a/src/modules/testimony/__tests__/services/deleteTestimony.spec.ts +++ b/src/modules/testimony/__tests__/services/deleteTestimony.spec.ts @@ -1,6 +1,135 @@ import { Test, TestingModule } from '@nestjs/testing'; import { DeleteTestimonyService } from '../../services/deleteTestimony.service'; +import { TestimonyRepository } from '../../repository/testimony.repository'; +import { TestimonyEntity } from '../../entity/testimony.entity'; -describe('Delete Testimony Tests', () => { +describe('DeleteTestimonyService', () => { + let service: DeleteTestimonyService; + let testimonyRepository: TestimonyRepository; -}); \ No newline at end of file + beforeEach(async () => { + // Cria mock repository + const mockTestimonyRepository = { + findTestimonyById: jest.fn(), + deleteTestimony: jest.fn(), + } as Partial>; + + // Cria testing module + const module: TestingModule = await Test.createTestingModule({ + providers: [ + DeleteTestimonyService, + { + provide: TestimonyRepository, + useValue: mockTestimonyRepository, + }, + ], + }).compile(); + + // Pega instancia do service e do repository + service = module.get(DeleteTestimonyService); + testimonyRepository = module.get(TestimonyRepository); + }); + + // Testa exclusão bem-sucedida de testimony + it('should delete an existing testimony', async () => { + // Arrange: Prepare test data + const testimonyId = 'testimony1'; + const mockTestimony: TestimonyEntity = { + id: testimonyId, + userName: 'John Doe', + description: 'Test testimony', + role: 'Mentor', + imageUrl: 'http://example.com/profile.jpg', + mentor_id: 'mentor1', + }; + + // Configura mocks + jest + .spyOn(testimonyRepository, 'findTestimonyById') + .mockResolvedValue(mockTestimony); + + const deleteTestimonySpy = jest + .spyOn(testimonyRepository, 'deleteTestimony') + .mockResolvedValue(undefined); + + // Act: Executa o método da service + const result = await service.execute(testimonyId); + + // Assert: Verifica comportamento esperado + expect(testimonyRepository.findTestimonyById).toHaveBeenCalledWith( + testimonyId, + ); + expect(deleteTestimonySpy).toHaveBeenCalledWith(testimonyId); + expect(result).toEqual({ + message: 'Testimony deleted successfully', + }); + }); + + // Testa tentativa de exclusão de testimony inexistente + it('should return message when testimony does not exist', async () => { + // Arrange + const nonExistentTestimonyId = 'non-existent-id'; + + // Configura mock para retornar null (testimony não encontrado) + jest + .spyOn(testimonyRepository, 'findTestimonyById') + .mockResolvedValue(null); + + const deleteTestimonySpy = jest.spyOn( + testimonyRepository, + 'deleteTestimony', + ); + + // Act + const result = await service.execute(nonExistentTestimonyId); + + // Assert + expect(testimonyRepository.findTestimonyById).toHaveBeenCalledWith( + nonExistentTestimonyId, + ); + expect(deleteTestimonySpy).not.toHaveBeenCalled(); + expect(result).toEqual({ + message: 'There are no testimony with that id', + }); + }); + + // Testa tratamento de erro durante a exclusão + it('should handle errors during testimony deletion', async () => { + // Arrange + const testimonyId = 'testimony1'; + const mockTestimony: TestimonyEntity = { + id: testimonyId, + userName: 'John Doe', + description: 'Test testimony', + role: 'Mentor', + imageUrl: 'http://example.com/profile.jpg', + mentor_id: 'mentor1', + }; + + // Configura mocks + jest + .spyOn(testimonyRepository, 'findTestimonyById') + .mockResolvedValue(mockTestimony); + + // Simula erro durante a exclusão + const deleteError = new Error('Deletion failed'); + const deleteTestimonySpy = jest + .spyOn(testimonyRepository, 'deleteTestimony') + .mockRejectedValue(deleteError); + + // Use console.log spy to verify error logging + const consoleSpy = jest.spyOn(console, 'log'); + + // Act & Assert + await expect(service.execute(testimonyId)).rejects.toThrow(deleteError); + + // Verify repository methods were called + expect(testimonyRepository.findTestimonyById).toHaveBeenCalledWith( + testimonyId, + ); + expect(deleteTestimonySpy).toHaveBeenCalledWith(testimonyId); + + // Clean up + consoleSpy.mockRestore(); + }); +}); From d46d0ce1bc872f0724828a57c010c44f0bfd5439 Mon Sep 17 00:00:00 2001 From: Jorgenettodev Date: Thu, 21 Nov 2024 06:20:55 -0300 Subject: [PATCH 4/6] test(testimonies): Adiciona teste unitario para EditTestimonyService MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Testa atualização bem sucedida do testimony - Testa atualizar testimony que nao existe - Testa error handling --- .../__tests__/services/editTestimony.spec.ts | 217 +++++++++++++++++- 1 file changed, 215 insertions(+), 2 deletions(-) diff --git a/src/modules/testimony/__tests__/services/editTestimony.spec.ts b/src/modules/testimony/__tests__/services/editTestimony.spec.ts index 4c7ef94..f9d9daf 100644 --- a/src/modules/testimony/__tests__/services/editTestimony.spec.ts +++ b/src/modules/testimony/__tests__/services/editTestimony.spec.ts @@ -1,6 +1,219 @@ import { Test, TestingModule } from '@nestjs/testing'; import { EditTestimonyService } from '../../services/editTestimony.service'; +import { TestimonyRepository } from '../../repository/testimony.repository'; +import { TestimonyEntity } from '../../entity/testimony.entity'; +import { CreateTestimonyDto } from '../../dto/create-testimony.dto'; +import * as formattersUtils from 'src/shared/utils/formatters.utils'; -describe('Edit Testimony Tests', () => { +describe('EditTestimonyService', () => { + let service: EditTestimonyService; + let testimonyRepository: TestimonyRepository; -}); \ No newline at end of file + beforeEach(async () => { + // Cria mock repository + const mockTestimonyRepository = { + findTestimonyById: jest.fn(), + editTestimony: jest.fn(), + } as Partial>; + + // Cria testing module + const module: TestingModule = await Test.createTestingModule({ + providers: [ + EditTestimonyService, + { + provide: TestimonyRepository, + useValue: mockTestimonyRepository, + }, + ], + }).compile(); + + // Instancia a service e repository + service = module.get(EditTestimonyService); + testimonyRepository = module.get(TestimonyRepository); + }); + + // Testa atualizacao bem sucedida de testimony + it('should update an existing testimony', async () => { + // Arrange: Prepare test data + const testimonyId = 'testimony1'; + const existingTestimony: TestimonyEntity = { + id: testimonyId, + userName: 'John Doe', + description: 'Original testimony', + role: 'Mentor', + imageUrl: 'http://example.com/profile.jpg', + mentor_id: 'mentor1', + }; + + const updateData: CreateTestimonyDto = { + userName: 'John Doe Updated', + description: 'Updated testimony description', + role: 'Mentor', + imageUrl: 'http://example.com/new-profile.jpg', + }; + + // Mocka métodos do repository + jest + .spyOn(testimonyRepository, 'findTestimonyById') + .mockResolvedValue(existingTestimony); + + const editTestimonySpy = jest + .spyOn(testimonyRepository, 'editTestimony') + .mockResolvedValue(undefined); + + // Mock dataFormatter + const dataFormatterSpy = jest + .spyOn(formattersUtils, 'dataFormatter') + .mockImplementation((data) => data); + + // Act: Execute the service method + const result = await service.execute(testimonyId, updateData); + + // Assert: Verify expected behavior + expect(testimonyRepository.findTestimonyById).toHaveBeenCalledWith( + testimonyId, + ); + expect(dataFormatterSpy).toHaveBeenCalledWith(updateData); + expect(editTestimonySpy).toHaveBeenCalledWith(testimonyId, updateData); + expect(result).toEqual({ + message: 'Testimony updated successfully', + }); + + // Clean up spy + dataFormatterSpy.mockRestore(); + }); + + // Testa atualizar testimony não existente + it('should return message when testimony does not exist', async () => { + // Arrange + const nonExistentTestimonyId = 'non-existent-id'; + const updateData: CreateTestimonyDto = { + userName: 'John Doe Updated', + description: 'Updated testimony description', + role: 'Mentor', + imageUrl: 'http://example.com/new-profile.jpg', + }; + + // Configure mock to return null (testimony not found) + jest + .spyOn(testimonyRepository, 'findTestimonyById') + .mockResolvedValue(null); + + const editTestimonySpy = jest.spyOn(testimonyRepository, 'editTestimony'); + + // Act + const result = await service.execute(nonExistentTestimonyId, updateData); + + // Assert + expect(testimonyRepository.findTestimonyById).toHaveBeenCalledWith( + nonExistentTestimonyId, + ); + expect(editTestimonySpy).not.toHaveBeenCalled(); + expect(result).toEqual({ + message: 'There are no testimony with that id.', + }); + }); + + // Test update with no changes to sensitive fields + it('should not call dataFormatter when no changes to userName or description', async () => { + // Arrange + const testimonyId = 'testimony1'; + const existingTestimony: TestimonyEntity = { + id: testimonyId, + userName: 'John Doe', + description: 'Original testimony', + role: 'Mentor', + imageUrl: 'http://example.com/profile.jpg', + mentor_id: 'mentor1', + }; + + const updateData: CreateTestimonyDto = { + userName: 'John Doe', + description: 'Original testimony', + role: 'Mentor', + imageUrl: 'http://example.com/new-profile.jpg', + }; + + // Mock repository methods + jest + .spyOn(testimonyRepository, 'findTestimonyById') + .mockResolvedValue(existingTestimony); + + const editTestimonySpy = jest + .spyOn(testimonyRepository, 'editTestimony') + .mockResolvedValue(undefined); + + // Mock dataFormatter + const dataFormatterSpy = jest + .spyOn(formattersUtils, 'dataFormatter') + .mockImplementation((data) => data); + + // Act + const result = await service.execute(testimonyId, updateData); + + // Assert + expect(testimonyRepository.findTestimonyById).toHaveBeenCalledWith( + testimonyId, + ); + expect(dataFormatterSpy).not.toHaveBeenCalled(); + expect(editTestimonySpy).toHaveBeenCalledWith(testimonyId, updateData); + expect(result).toEqual({ + message: 'Testimony updated successfully', + }); + + // Clean up spy + dataFormatterSpy.mockRestore(); + }); + + // Test error handling during testimony update + it('should handle errors during testimony update', async () => { + // Arrange + const testimonyId = 'testimony1'; + const existingTestimony: TestimonyEntity = { + id: testimonyId, + userName: 'John Doe', + description: 'Original testimony', + role: 'Mentor', + imageUrl: 'http://example.com/profile.jpg', + mentor_id: 'mentor1', + }; + + const updateData: CreateTestimonyDto = { + userName: 'John Doe Updated', + description: 'Updated testimony description', + role: 'Mentor', + imageUrl: 'http://example.com/new-profile.jpg', + }; + + // Configure mocks + jest + .spyOn(testimonyRepository, 'findTestimonyById') + .mockResolvedValue(existingTestimony); + + // Simulate error during update + const updateError = new Error('Update failed'); + const editTestimonySpy = jest + .spyOn(testimonyRepository, 'editTestimony') + .mockRejectedValue(updateError); + + // Mock dataFormatter + const dataFormatterSpy = jest + .spyOn(formattersUtils, 'dataFormatter') + .mockImplementation((data) => data); + + // Act & Assert + await expect(service.execute(testimonyId, updateData)).rejects.toThrow( + updateError, + ); + + // Verify repository methods were called + expect(testimonyRepository.findTestimonyById).toHaveBeenCalledWith( + testimonyId, + ); + expect(dataFormatterSpy).toHaveBeenCalledWith(updateData); + expect(editTestimonySpy).toHaveBeenCalledWith(testimonyId, updateData); + + // Clean up spies + dataFormatterSpy.mockRestore(); + }); +}); From de06d42cc210f770e0b2b52584e210e9660b6ecc Mon Sep 17 00:00:00 2001 From: Jorgenettodev Date: Fri, 22 Nov 2024 05:43:59 -0300 Subject: [PATCH 5/6] test(testimonies): Adiciona teste para TestimonyController --- .../__tests__/testimony.controller.spec.ts | 221 ++++++++++++++++++ .../__tests__/tetimony.controller.spec.ts | 6 - 2 files changed, 221 insertions(+), 6 deletions(-) create mode 100644 src/modules/testimony/__tests__/testimony.controller.spec.ts delete mode 100644 src/modules/testimony/__tests__/tetimony.controller.spec.ts diff --git a/src/modules/testimony/__tests__/testimony.controller.spec.ts b/src/modules/testimony/__tests__/testimony.controller.spec.ts new file mode 100644 index 0000000..c87fb35 --- /dev/null +++ b/src/modules/testimony/__tests__/testimony.controller.spec.ts @@ -0,0 +1,221 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { TestimonyController } from '../testimony.controller'; +import { CreateTestimonyService } from '../services/createTestimony.service'; +import { EditTestimonyService } from '../services/editTestimony.service'; +import { GetAllTestimoniesService } from '../services/getTestimonies.service'; +import { DeleteTestimonyService } from '../services/deleteTestimony.service'; +import { CreateTestimonyDto } from '../dto/create-testimony.dto'; +import { MentorEntity } from '../../mentors/entities/mentor.entity'; +import { GetByIdDto } from '../dto/get-by-id.dto copy'; +import { TestimonyEntity } from '../entity/testimony.entity'; +import { AuthGuard, PassportModule } from '@nestjs/passport'; + +// Mock authGuard +jest.mock('@nestjs/passport', () => { + return { + AuthGuard: () => jest.fn().mockImplementation(() => true), + PassportModule: { + register: jest.fn(), + }, + }; +}); + +describe('TestimonyController', () => { + let controller: TestimonyController; + let createTestimonyService: CreateTestimonyService; + let editTestimonyService: EditTestimonyService; + let getAllTestimoniesService: GetAllTestimoniesService; + let deleteTestimonyService: DeleteTestimonyService; + + beforeEach(async () => { + // Cria mock services + const mockServices = { + createTestimonyService: { + execute: jest.fn(), + }, + editTestimonyService: { + execute: jest.fn(), + }, + getAllTestimoniesService: { + execute: jest.fn(), + }, + deleteTestimonyService: { + execute: jest.fn(), + }, + }; + + // cria testing module + const module: TestingModule = await Test.createTestingModule({ + controllers: [TestimonyController], + providers: [ + { + provide: CreateTestimonyService, + useValue: mockServices.createTestimonyService, + }, + { + provide: EditTestimonyService, + useValue: mockServices.editTestimonyService, + }, + { + provide: GetAllTestimoniesService, + useValue: mockServices.getAllTestimoniesService, + }, + { + provide: DeleteTestimonyService, + useValue: mockServices.deleteTestimonyService, + }, + ], + }).compile(); + + controller = module.get(TestimonyController); + createTestimonyService = module.get( + CreateTestimonyService, + ); + editTestimonyService = + module.get(EditTestimonyService); + getAllTestimoniesService = module.get( + GetAllTestimoniesService, + ); + deleteTestimonyService = module.get( + DeleteTestimonyService, + ); + }); + + it('should be defined', () => { + expect(controller).toBeDefined(); + }); + + describe('getTestimonies', () => { + it('should return all testimonies', async () => { + // Arrange + const mockTestimonies: TestimonyEntity[] = [ + { + id: '1', + userName: 'John Doe', + description: 'Great experience', + role: 'Student', + imageUrl: 'http://example.com/image1.jpg', + mentor_id: 'mentor1', + }, + { + id: '2', + userName: 'Jane Smith', + description: 'Excellent mentor', + role: 'Professional', + imageUrl: 'http://example.com/image2.jpg', + mentor_id: 'mentor2', + }, + ]; + + jest + .spyOn(getAllTestimoniesService, 'execute') + .mockResolvedValue(mockTestimonies); + + // Act + const result = await controller.getTestimonies(); + + // Assert + expect(getAllTestimoniesService.execute).toHaveBeenCalled(); + expect(result).toEqual(mockTestimonies); + }); + }); + + describe('createTestimony', () => { + it('should create a new testimony', async () => { + // Arrange + const createTestimonyDto: CreateTestimonyDto = { + userName: 'John Doe', + description: 'Great experience', + role: 'Student', + imageUrl: 'http://example.com/image.jpg', + }; + + const mockMentor: MentorEntity = { + id: 'mentor1', + fullName: 'Mentor Name', + email: 'mentor@example.com', + password: 'hashedPassword', + dateOfBirth: new Date('1980-01-01'), + specialties: ['Specialty1', 'Specialty2'], + role: 'Mentor', + gender: 'Male', + aboutMe: 'About the mentor', + }; + + const expectedResponse = { + message: 'Testimony created successfully', + }; + + jest + .spyOn(createTestimonyService, 'execute') + .mockResolvedValue(expectedResponse); + + // Act + const result = await controller.createTestimony( + mockMentor, + createTestimonyDto, + ); + + // Assert + expect(createTestimonyService.execute).toHaveBeenCalledWith( + createTestimonyDto, + mockMentor, + ); + expect(result).toEqual(expectedResponse); + }); + }); + + describe('editTestimony', () => { + it('should edit an existing testimony', async () => { + // Arrange + const updateTestimonyDto: CreateTestimonyDto = { + userName: 'John Doe Updated', + description: 'Updated experience', + role: 'Professional', + imageUrl: 'http://example.com/new-image.jpg', + }; + + const params: GetByIdDto = { id: 'testimony1' }; + + const expectedResponse = { + message: 'Testimony updated successfully', + }; + + jest + .spyOn(editTestimonyService, 'execute') + .mockResolvedValue(expectedResponse); + + // Act + const result = await controller.editTestimony(updateTestimonyDto, params); + + // Assert + expect(editTestimonyService.execute).toHaveBeenCalledWith( + params.id, + updateTestimonyDto, + ); + expect(result).toEqual(expectedResponse); + }); + }); + + describe('deleteTestimony', () => { + it('should delete an existing testimony', async () => { + // Arrange + const params: GetByIdDto = { id: 'testimony1' }; + + const expectedResponse = { + message: 'Testimony deleted successfully', + }; + + jest + .spyOn(deleteTestimonyService, 'execute') + .mockResolvedValue(expectedResponse); + + // Act + const result = await controller.deleteTestimony(params); + + // Assert + expect(deleteTestimonyService.execute).toHaveBeenCalledWith(params.id); + expect(result).toEqual(expectedResponse); + }); + }); +}); diff --git a/src/modules/testimony/__tests__/tetimony.controller.spec.ts b/src/modules/testimony/__tests__/tetimony.controller.spec.ts deleted file mode 100644 index dad0763..0000000 --- a/src/modules/testimony/__tests__/tetimony.controller.spec.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { TestimonyController } from '../testimony.controller'; - -describe('Testimony Controller Tests', () => { - -}); \ No newline at end of file From 1f8c4b44efbd7beacda733d88b834033ff11b950 Mon Sep 17 00:00:00 2001 From: Jorgenettodev Date: Mon, 25 Nov 2024 06:58:28 -0300 Subject: [PATCH 6/6] Correcao de bug que os testes nao achavam o caminho dos arquivos. --- package-lock.json | 1100 +++++++++++++++++++++++++++++++++++++++++++-- package.json | 27 +- tsconfig.json | 3 + 3 files changed, 1076 insertions(+), 54 deletions(-) diff --git a/package-lock.json b/package-lock.json index c26cc77..72fdce9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,11 +33,11 @@ "@commitlint/config-conventional": "^17.6.3", "@nestjs/cli": "^9.0.0", "@nestjs/schematics": "^9.0.0", - "@nestjs/testing": "^9.0.0", + "@nestjs/testing": "^9.4.3", "@prisma/client": "^5.21.1", "@types/bcrypt": "^5.0.0", "@types/express": "^4.17.13", - "@types/jest": "29.2.4", + "@types/jest": "^29.5.14", "@types/node": "18.11.18", "@types/nodemailer": "^6.4.7", "@types/passport-jwt": "^3.0.8", @@ -55,7 +55,8 @@ "prisma": "^5.21.1", "source-map-support": "^0.5.20", "supertest": "^6.1.3", - "ts-jest": "29.0.3", + "test": "^3.3.0", + "ts-jest": "^29.0.3", "ts-loader": "^9.2.3", "ts-node": "^10.0.0", "tsconfig-paths": "4.1.1", @@ -2310,12 +2311,13 @@ } }, "node_modules/@nestjs/testing": { - "version": "9.3.12", - "resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-9.3.12.tgz", - "integrity": "sha512-nH274IXEqU4hr4bcb71POe58hYLONt9RcfKKM5ZvOS7wYMnybMpKKR8DkC1WcfE1P2k2GQmQoHeSH5emPtYrBA==", + "version": "9.4.3", + "resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-9.4.3.tgz", + "integrity": "sha512-LDT8Ai2eKnTzvnPaJwWOK03qTaFap5uHHsJCv6dL0uKWk6hyF9jms8DjyVaGsaujCaXDG8izl1mDEER0OmxaZA==", "dev": true, + "license": "MIT", "dependencies": { - "tslib": "2.5.0" + "tslib": "2.5.3" }, "funding": { "type": "opencollective", @@ -2336,6 +2338,13 @@ } } }, + "node_modules/@nestjs/testing/node_modules/tslib": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", + "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", + "dev": true, + "license": "0BSD" + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -2698,10 +2707,11 @@ } }, "node_modules/@types/jest": { - "version": "29.2.4", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.2.4.tgz", - "integrity": "sha512-PipFB04k2qTRPePduVLTRiPzQfvMeLwUN3Z21hsAKaB/W9IIzgB2pizCL466ftJlcyZqnHoC9ZHpxLGl3fS86A==", + "version": "29.5.14", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.14.tgz", + "integrity": "sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ==", "dev": true, + "license": "MIT", "dependencies": { "expect": "^29.0.0", "pretty-format": "^29.0.0" @@ -3231,6 +3241,19 @@ "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dev": true, + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -3471,6 +3494,23 @@ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", + "integrity": "sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.5", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -3491,6 +3531,29 @@ "node": ">=8" } }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", + "integrity": "sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "es-abstract": "^1.22.3", + "es-errors": "^1.2.1", + "get-intrinsic": "^1.2.3", + "is-array-buffer": "^3.0.4", + "is-shared-array-buffer": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", @@ -3542,9 +3605,13 @@ } }, "node_modules/available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, "engines": { "node": ">= 0.4" }, @@ -3965,12 +4032,19 @@ } }, "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "license": "MIT", "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4769,6 +4843,60 @@ "node": ">= 6" } }, + "node_modules/data-view-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", + "integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz", + "integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", + "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -4858,6 +4986,41 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/degenerator": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-3.0.4.tgz", @@ -5252,12 +5415,140 @@ "is-arrayish": "^0.2.1" } }, + "node_modules/es-abstract": { + "version": "1.23.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", + "integrity": "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "arraybuffer.prototype.slice": "^1.0.3", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "data-view-buffer": "^1.0.1", + "data-view-byte-length": "^1.0.1", + "data-view-byte-offset": "^1.0.0", + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-set-tostringtag": "^2.0.3", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.6", + "get-intrinsic": "^1.2.4", + "get-symbol-description": "^1.0.2", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.0.3", + "has-symbols": "^1.0.3", + "hasown": "^2.0.2", + "internal-slot": "^1.0.7", + "is-array-buffer": "^3.0.4", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.1", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.3", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.13", + "is-weakref": "^1.0.2", + "object-inspect": "^1.13.1", + "object-keys": "^1.1.1", + "object.assign": "^4.1.5", + "regexp.prototype.flags": "^1.5.2", + "safe-array-concat": "^1.1.2", + "safe-regex-test": "^1.0.3", + "string.prototype.trim": "^1.2.9", + "string.prototype.trimend": "^1.0.8", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.2", + "typed-array-byte-length": "^1.0.1", + "typed-array-byte-offset": "^1.0.2", + "typed-array-length": "^1.0.6", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.15" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/es-module-lexer": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", "dev": true }, + "node_modules/es-object-atoms": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", + "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", + "integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.4", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -5645,6 +5936,16 @@ "node": ">= 0.6" } }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", @@ -6357,9 +6658,42 @@ "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==" }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/gauge": { "version": "3.0.2", @@ -6398,13 +6732,19 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", - "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "license": "MIT", "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -6442,6 +6782,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/get-symbol-description": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz", + "integrity": "sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/get-uri": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-3.0.2.tgz", @@ -6715,6 +7073,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/globby": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", @@ -6805,6 +7180,16 @@ "node": ">= 0.4.0" } }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -6813,6 +7198,30 @@ "node": ">=8" } }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", @@ -6825,11 +7234,12 @@ } }, "node_modules/has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", "dependencies": { - "has-symbols": "^1.0.2" + "has-symbols": "^1.0.3" }, "engines": { "node": ">= 0.4" @@ -6843,6 +7253,18 @@ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==" }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -7177,6 +7599,21 @@ "node": ">=12.0.0" } }, + "node_modules/internal-slot": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", + "integrity": "sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.0", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/interpret": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", @@ -7214,12 +7651,42 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-array-buffer": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", + "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -7231,6 +7698,23 @@ "node": ">=8" } }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -7253,6 +7737,38 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-data-view": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", + "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-docker": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", @@ -7346,6 +7862,19 @@ "node": ">=8" } }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -7354,6 +7883,22 @@ "node": ">=0.12.0" } }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", @@ -7401,6 +7946,22 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", + "integrity": "sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -7413,6 +7974,38 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-text-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", @@ -7426,11 +8019,12 @@ } }, "node_modules/is-typed-array": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", - "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", + "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", + "license": "MIT", "dependencies": { - "which-typed-array": "^1.1.11" + "which-typed-array": "^1.1.14" }, "engines": { "node": ">= 0.4" @@ -7457,6 +8051,19 @@ "integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==", "dev": true }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -9758,9 +10365,42 @@ } }, "node_modules/object-inspect": { - "version": "1.12.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", - "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", + "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -10318,6 +10958,15 @@ "node": ">=4" } }, + "node_modules/possible-typed-array-names": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", + "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -10429,6 +11078,16 @@ "fsevents": "2.3.3" } }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -10962,6 +11621,25 @@ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.3.tgz", + "integrity": "sha512-vqlC04+RQoFalODCbCumG2xIOvapzVMHwsyIGM/SIE8fRhFFsXeH8/QQ+s0T0kDAhKc4k30s73/0ydkHQz6HlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/relateurl": { "version": "0.2.7", "resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz", @@ -11316,6 +11994,32 @@ "tslib": "^2.1.0" } }, + "node_modules/safe-array-concat": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", + "integrity": "sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "get-intrinsic": "^1.2.4", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-array-concat/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true, + "license": "MIT" + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -11335,6 +12039,24 @@ } ] }, + "node_modules/safe-regex-test": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz", + "integrity": "sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-regex": "^1.1.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -11504,6 +12226,39 @@ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", @@ -11818,6 +12573,81 @@ "node": ">=8" } }, + "node_modules/string.prototype.replaceall": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/string.prototype.replaceall/-/string.prototype.replaceall-1.0.10.tgz", + "integrity": "sha512-PKLapcZUZmXUdfIM6rTTTMYOxaj4JiQrgl0SKEeCFug1CdMAuJq8hVZd4eek9yMXAW4ldGUq+TiZRtjLJRU96g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.4", + "has-symbols": "^1.0.3", + "is-regex": "^1.1.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", + "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", + "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -12124,6 +12954,24 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, + "node_modules/test": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/test/-/test-3.3.0.tgz", + "integrity": "sha512-JKlEohxDIJRjwBH/+BrTcAPHljBALrAHw3Zs99RqZlaC605f6BggqXhxkdqZThbSHgaYPwpNJlf9bTSWkb/1rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6", + "readable-stream": "^4.3.0", + "string.prototype.replaceall": "^1.0.6" + }, + "bin": { + "node--test": "bin/node--test.js", + "node--test-name-pattern": "bin/node--test-name-pattern.js", + "node--test-only": "bin/node--test-only.js", + "test": "bin/node-core-test.js" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -12138,6 +12986,58 @@ "node": ">=8" } }, + "node_modules/test/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/test/node_modules/readable-stream": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/test/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/text-extensions": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz", @@ -12268,6 +13168,7 @@ "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.0.3.tgz", "integrity": "sha512-Ibygvmuyq1qp/z3yTh9QTwVVAbFdDy/+4BtIQR2sp6baF2SJU/8CKK/hhnGIDY2L90Az2jIqTwZPnN2p+BweiQ==", "dev": true, + "license": "MIT", "dependencies": { "bs-logger": "0.x", "fast-json-stable-stringify": "2.x", @@ -12499,6 +13400,83 @@ "node": ">= 0.6" } }, + "node_modules/typed-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", + "integrity": "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz", + "integrity": "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz", + "integrity": "sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==", + "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.6.tgz", + "integrity": "sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -12544,6 +13522,22 @@ "node": ">=8" } }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/underscore": { "version": "1.13.6", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", @@ -12980,16 +13974,34 @@ "node": ">= 8" } }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/which-typed-array": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz", - "integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==", + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", + "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", + "license": "MIT", "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", "for-each": "^0.3.3", "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0" + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" diff --git a/package.json b/package.json index 52f2de3..bca0693 100644 --- a/package.json +++ b/package.json @@ -51,11 +51,11 @@ "@commitlint/config-conventional": "^17.6.3", "@nestjs/cli": "^9.0.0", "@nestjs/schematics": "^9.0.0", - "@nestjs/testing": "^9.0.0", + "@nestjs/testing": "^9.4.3", "@prisma/client": "^5.21.1", "@types/bcrypt": "^5.0.0", "@types/express": "^4.17.13", - "@types/jest": "29.2.4", + "@types/jest": "^29.5.14", "@types/node": "18.11.18", "@types/nodemailer": "^6.4.7", "@types/passport-jwt": "^3.0.8", @@ -73,7 +73,8 @@ "prisma": "^5.21.1", "source-map-support": "^0.5.20", "supertest": "^6.1.3", - "ts-jest": "29.0.3", + "test": "^3.3.0", + "ts-jest": "^29.0.3", "ts-loader": "^9.2.3", "ts-node": "^10.0.0", "tsconfig-paths": "4.1.1", @@ -81,11 +82,12 @@ }, "jest": { "moduleFileExtensions": [ - "js", - "json", - "ts"], + "js", + "json", + "ts" + ], "rootDir": "src", - "testRegex": ".*\\.spec\\.ts$", + "testRegex": "..spec.ts$", "coverageThreshold": { "global": { "branches": 85, @@ -95,11 +97,16 @@ } }, "transform": { - "^.+\\.(t|j)s$": "ts-jest" + "^.+.(t|j)s$": "ts-jest" }, - "collectCoverageFrom": ["**/*.(t|j)s"], + "collectCoverageFrom": [ + "**/.(t|j)s" + ], "coverageDirectory": "../coverage", - "testEnvironment": "node" + "testEnvironment": "node", + "moduleNameMapper": { + "^src/(.*)$": "/$1" + } }, "pre-push": [ "test:cov" diff --git a/tsconfig.json b/tsconfig.json index 95f5641..83fd5bf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,9 @@ "sourceMap": true, "outDir": "./dist", "baseUrl": "./", + "paths": { + "src/": ["src/"] + }, "incremental": true, "skipLibCheck": true, "strictNullChecks": false,