-
-
Notifications
You must be signed in to change notification settings - Fork 40
Feature/mail service tests #199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,46 @@ | ||
| version: '3.9' | ||
|
|
||
| services: | ||
| database_soujunior: | ||
| image: postgres | ||
| container_name: database_soujunior | ||
| postgres: | ||
| image: postgres:16-alpine | ||
| container_name: postgres | ||
| restart: always | ||
| ports: | ||
| - 5432:5432 | ||
| environment: | ||
| - POSTGRES_USER=docker | ||
| - POSTGRES_PASSWORD=ignite | ||
| - POSTGRES_DB=linkedin_backend | ||
| - POSTGRES_USER=postgres | ||
| - POSTGRES_PASSWORD=123 | ||
| - POSTGRES_DB=vagas-api | ||
| volumes: | ||
| - pgdata:/data/postgres | ||
| - pgdata:/var/lib/postgresql/data | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "pg_isready"] | ||
| test: ['CMD-SHELL', 'pg_isready -U postgres'] | ||
| interval: 10s | ||
| timeout: 5s | ||
| retries: 5 | ||
|
|
||
| mailhog: | ||
| image: mailhog/mailhog | ||
| container_name: mailhog | ||
| restart: always | ||
| ports: | ||
| - 1025:1025 | ||
| - 8025:8025 | ||
|
|
||
| app: | ||
| build: . | ||
| container_name: linkedIn_Backend | ||
| container_name: vagas_api | ||
| restart: always | ||
| ports: | ||
| - 3000:3000 | ||
| volumes: | ||
| - .:/user/app | ||
| depends_on: | ||
| database_soujunior: | ||
| postgres: | ||
| condition: service_healthy | ||
| env_file: | ||
| - .env | ||
|
|
||
| volumes: | ||
| pgdata: | ||
| driver: local | ||
| driver: local |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import { Injectable } from '@nestjs/common'; | ||
| import * as bcrypt from 'bcrypt'; | ||
| import { MailService } from 'src/modules/mails/mail.service'; | ||
| import { MailService } from '../../mails/mail.service'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major 🧩 Analysis chainVerifique a consistência do estilo de imports. A mudança de import absoluto para relativo é funcional, mas é importante manter consistência em toda a base de código. Verifique se o projeto adota um padrão específico para imports. Execute o seguinte script para verificar o padrão de imports no projeto: 🏁 Script executed: #!/bin/bash
# Descrição: Verificar padrão de imports para MailService
# Buscar imports absolutos do MailService
echo "=== Imports absolutos ==="
rg -n "from 'src/modules/mails/mail.service'" --type=ts
# Buscar imports relativos do MailService
echo "=== Imports relativos ==="
rg -n "from '\.\./.*mails/mail\.service'" --type=tsLength of output: 1775 Estabeleça um padrão consistente de imports em toda a base de código. A verificação confirmou que o projeto não adota um padrão claro e uniforme para imports. Foram encontrados:
Embora a mudança para imports relativos seja funcional e mantenha consistência dentro do módulo
🤖 Prompt for AI Agents |
||
| import { CreatePasswordHashDto } from '../dtos/update-my-password.dto'; | ||
| import { UserRepository } from '../repository/user.repository'; | ||
|
|
||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alguns Pontos. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { Chance } from 'chance'; | ||
| import { CompaniesEntity } from '../../../src/database/entities/companies.entity'; | ||
|
|
||
| const chance = new Chance(); | ||
|
|
||
| export const companyMailMock = (): CompaniesEntity => ({ | ||
| id: chance.guid(), | ||
| companyName: chance.company(), | ||
| email: chance.email(), | ||
| cnpj: '12345678000199', | ||
| password: chance.hash({ length: 60 }), | ||
| recoverPasswordToken: chance.string({ | ||
| length: 32, | ||
| alpha: true, | ||
| numeric: true, | ||
| }), | ||
| mailConfirm: false, | ||
| created_at: new Date(), | ||
| updated_at: new Date(), | ||
| companyType: 'Tecnologia', | ||
| companySize: 'SMALL_SIZE', | ||
| uf: 'SP', | ||
| otherSite: { | ||
| instagram: chance.url(), | ||
| linkedin: chance.url(), | ||
| twitter: chance.url(), | ||
| }, | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| companySite: chance.url(), | ||
| description: chance.sentence(), | ||
| profile: null, | ||
| profileKey: null, | ||
| jobs: [], | ||
| }); | ||
|
|
||
| export const companyMailWithoutTokenMock = (): CompaniesEntity => ({ | ||
| ...companyMailMock(), | ||
| recoverPasswordToken: null, | ||
| mailConfirm: true, | ||
| }); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alguns Pontos. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import { StatusEnum } from '../../../src/shared/enums/status.enum'; | ||
| import { JobsEntity } from '../../../src/database/entities/jobs.entity'; | ||
| import { companyMailMock } from './company-mail.mock'; | ||
|
|
||
| export const jobMailMock = (): JobsEntity => ({ | ||
| id: '456e7890-e89b-12d3-a456-426614174001', | ||
| title: 'Desenvolvedor Frontend Junior', | ||
| description: 'Vaga para desenvolvedor frontend com foco em React', | ||
| prerequisites: 'Conhecimento em React, JavaScript, HTML, CSS', | ||
| benefits: 'Vale alimentação, Vale transporte, Plano de saúde', | ||
| type: 'JUNIOR', | ||
| typeContract: 'CLT', | ||
| contractText: null, | ||
| salaryMin: 3000, | ||
| salaryMax: 5000, | ||
| modality: 'REMOTE', | ||
| federalUnit: 'SP', | ||
| city: 'São Paulo', | ||
| openEndedContract: true, | ||
| contractType: null, | ||
| affirmative: false, | ||
| affirmativeType: null, | ||
| status: StatusEnum.ACTIVE, | ||
| content: null, | ||
| company_id: '123e4567-e89b-12d3-a456-426614174000', | ||
| createdAt: new Date(), | ||
| updatedAt: new Date(), | ||
| company: companyMailMock(), | ||
| applications: [], | ||
| comments: [], | ||
| }); | ||
|
|
||
| export const jobMailListMock = (): JobsEntity[] => [ | ||
| jobMailMock(), | ||
| { | ||
| ...jobMailMock(), | ||
| id: '456e7890-e89b-12d3-a456-426614174002', | ||
| title: 'Desenvolvedor Backend Junior', | ||
| description: 'Vaga para desenvolvedor backend com foco em Node.js', | ||
| prerequisites: 'Conhecimento em Node.js, TypeScript, Banco de dados', | ||
| }, | ||
| { | ||
| ...jobMailMock(), | ||
| id: '456e7890-e89b-12d3-a456-426614174003', | ||
| title: 'Desenvolvedor Fullstack Junior', | ||
| description: 'Vaga para desenvolvedor fullstack', | ||
| prerequisites: 'Conhecimento em React, Node.js, TypeScript', | ||
| }, | ||
| ]; |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok! ✅ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { jobMailListMock } from './job-mail.mock'; | ||
|
|
||
| export const mailOptionsMock = () => ({ | ||
| subject: 'Teste de Email', | ||
| template: './test-template', | ||
| context: { | ||
| name: 'Usuario Teste', | ||
| message: 'Esta é uma mensagem de teste', | ||
| url: 'https://example.com/test', | ||
| }, | ||
| email: 'test@example.com', | ||
| }); | ||
|
|
||
| export const jobAlertMailOptionsMock = () => ({ | ||
| email: 'candidate@example.com', | ||
| jobs: jobMailListMock(), | ||
| }); |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alguns pontos. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { UsersEntity } from '../../../src/database/entities/users.entity'; | ||
|
|
||
| export const userMailMock = (): UsersEntity => ({ | ||
| id: '729c7919-583c-40a5-b0ca-137e282345d4', | ||
| name: 'Test User', | ||
| email: 'user@example.com', | ||
| password: 'hashedPassword123', | ||
| recoverPasswordToken: 'recover-token-123', | ||
| mailConfirm: false, | ||
| type: 'USER', | ||
| policies: true, | ||
| created_at: new Date(), | ||
| updated_at: new Date(), | ||
| ip: '127.0.0.1', | ||
| mainPhone: '11999999999', | ||
| phone: '1133333333', | ||
| city: 'São Paulo', | ||
| state: 'SP', | ||
| profile: null, | ||
| profileKey: null, | ||
| personalData: null, | ||
| curriculums: [], | ||
| applications: [], | ||
| candidacies: [], | ||
| }); | ||
|
|
||
| export const userMailWithoutTokenMock = (): UsersEntity => ({ | ||
| ...userMailMock(), | ||
| recoverPasswordToken: null, | ||
| mailConfirm: true, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Correção de typo importante, mas verifique o impacto.
A correção de "instagran" para "instagram" é necessária. No entanto, essa mudança pode quebrar código que referencia o nome antigo do campo. Verifique se há código que acessa
otherSite.instagrane atualize-o paraotherSite.instagram.Execute o seguinte script para verificar referências ao campo antigo:
🏁 Script executed:
Length of output: 179
Atualize o DTO para refletir a correção do campo "instagran" para "instagram".
A verificação identificou que o arquivo DTO ainda referencia o nome antigo do campo em dois locais:
src/modules/company/dtos/update-company.dto.ts:46— campo em dados de exemplosrc/modules/company/dtos/update-company.dto.ts:55— declaração da propriedadeAtualize ambas as referências de
instagranparainstagrampara manter a consistência entre a entidade e o DTO, evitando erros em tempo de execução.🤖 Prompt for AI Agents