Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
17e5779
chore: biblioteca jwt
Aug 22, 2024
a5eaec2
chore: decode and get token
Aug 22, 2024
3f75255
chore: middleware começou a ser implementado
Aug 22, 2024
951ca70
chore: add types jest e supertest
LucasEmanoel0 Aug 22, 2024
3b42b19
chore: mudança
LucasEmanoel0 Aug 22, 2024
4278942
chore: add conexao database
LucasEmanoel0 Aug 22, 2024
8f47fe1
chore: add logica pegar id do database
LucasEmanoel0 Aug 22, 2024
d55d377
chore: mudança de espaço
LucasEmanoel0 Aug 22, 2024
173c560
chore: add logica test autenticação
LucasEmanoel0 Aug 22, 2024
4c761a8
chore: add rota test autenticação
LucasEmanoel0 Aug 22, 2024
ab1949f
chore: add supertest
LucasEmanoel0 Aug 22, 2024
2e07337
chore: add pg
LucasEmanoel0 Aug 22, 2024
050fb56
chore: melhor validação de erro
Aug 22, 2024
a29751b
chore: formatação
Aug 22, 2024
e0970b6
chore: moment adicionado
Aug 22, 2024
3612fea
chore: começando a implementar segundo teste
Aug 22, 2024
3ec67b0
chore: melhor validação de token vazio
Aug 22, 2024
46ca111
chore: mudança de message para error
LucasEmanoel0 Aug 23, 2024
c53ada3
chore: add test autenticação
LucasEmanoel0 Aug 23, 2024
6b98714
chore: informação do erro no body de resposta
Aug 23, 2024
151f25c
chore: add env database
LucasEmanoel0 Aug 23, 2024
57a1269
chore: consertando workflow
Aug 23, 2024
7d6b8fb
feat: middleware de autenticação
Aug 23, 2024
bcdcced
test: ultimo teste para validação de resposta de middleware
Aug 23, 2024
593421b
chore: moment removido
Aug 23, 2024
48ef2ce
chore: melhor validação de retornos do pool
Aug 23, 2024
02f1049
chore: comentarios pra ajudar alguem
Aug 23, 2024
2651baa
chore: melhor validação de id
Aug 23, 2024
b04d291
test: test para validação de id
Aug 23, 2024
fea3180
chore: melhor utilização do sign
Aug 24, 2024
dce745b
chore: nome mudado
Aug 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 32 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
name: Testes Unitarios

on: [push, pull_request]
env:
POSTGRES_USER: ${{vars.POSTGRES_USER}}
POSTGRES_PASSWORD: ${{vars.POSTGRES_PASSWORD}}
POSTGRES_HOST: ${{vars.POSTGRES_HOST}}
POSTGRES_PORT: ${{vars.POSTGRES_PORT}}
POSTGRES_DATABASE: ${{vars.POSTGRES_DATABASE}}
JWT_SECRET: ${{secrets.JWT_SECRET}}

jobs:
CI:
runs-on: ubuntu-latest
steps:
- name: Verificação do Repositorio
uses: actions/checkout@v4.1.7
- name: Configurando Node.Js
uses: actions/setup-node@v4.0.3
with:
node-version: '20'
- name: Instalando Dependencias
run: npm clean-install
- name: Executando Testes
run: npm run test
- name: Verificação do Repositorio
uses: actions/checkout@v4.1.7

- name: Iniciando Docker Compose
uses: hoverkraft-tech/compose-action@v2.0.1
with:
services: database
compose-file: ./docker-compose.yml

- name: Configurando Node.Js
uses: actions/setup-node@v4.0.3
with:
node-version: '20'

- name: Instalando Dependencias
run: npm clean-install

- name: Executando Testes
run: npm run test
env:
POSTGRES_HOST: ${{env.POSTGRES_HOST}}
POSTGRES_PORT: ${{env.POSTGRES_PORT}}
POSTGRES_USER: ${{env.POSTGRES_USER}}
POSTGRES_PASSWORD: ${{env.POSTGRES_PASSWORD}}
POSTGRES_DATABASE: ${{env.POSTGRES_DATABASE}}
JWT_SECRET: ${{env.JWT_SECRET}}
6 changes: 3 additions & 3 deletions jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ const config = {
// collectCoverageFrom: undefined,

// The directory where Jest should output its coverage files
coverageDirectory: "coverage",
coverageDirectory: 'coverage',

// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],

// Indicates which provider should be used to instrument code for coverage
coverageProvider: "v8",
coverageProvider: 'v8',

// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: [
Expand Down Expand Up @@ -60,7 +60,7 @@ const config = {
// forceCoverageMatch: [],

// A path to a module which exports an async function that is triggered once before all test suites
// globalSetup: undefined,
globalSetup: './jest.setup.js',

// A path to a module which exports an async function that is triggered once after all test suites
// globalTeardown: undefined,
Expand Down
5 changes: 5 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { configDotenv } from 'dotenv';

export default () => {
configDotenv();
};
Loading