Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ad48d20
chore: configuração de dependencias
MrErykCardoso Aug 21, 2024
de79cd2
chore: configuração do jest
MrErykCardoso Aug 21, 2024
5831466
chore: configuracao de BD, alteracao das colunas de id de interger pa…
MrErykCardoso Aug 21, 2024
080f337
chore: configuração de acesso ao database
MrErykCardoso Aug 21, 2024
ba13048
chore: configuração das rotas
MrErykCardoso Aug 21, 2024
d2a8e08
chore: preparação do arquivo de teste user.controller.test.js
MrErykCardoso Aug 21, 2024
5be5887
test: pass 200 criação de usuario
MrErykCardoso Aug 21, 2024
6b61047
chore: preparação do arquivo user.controller.js
MrErykCardoso Aug 21, 2024
d29e40f
chore: implementação da criação de usuário
MrErykCardoso Aug 21, 2024
22d9c76
test: error 400 criação de usuário
MrErykCardoso Aug 21, 2024
f7ce9f1
chore: implementação do error 400
MrErykCardoso Aug 21, 2024
9a5d962
test: error 409 conflict usuário já existente e reorganização dos testes
MrErykCardoso Aug 21, 2024
575045d
chore: implementação do error 409
MrErykCardoso Aug 21, 2024
eb3e850
test: error 400 bad request de restrição de escrita do username
MrErykCardoso Aug 21, 2024
7bc9756
feat: criação de conta e perfil de usuário
MrErykCardoso Aug 21, 2024
71d7267
ci: implementando novo workflow
heyitsmepablo Aug 21, 2024
51af3bd
chore: correções de escrita
MrErykCardoso Aug 24, 2024
5507da2
chore: correções de escrita
MrErykCardoso Aug 24, 2024
7d871a4
chore: correções de escrita
MrErykCardoso Aug 24, 2024
7838f2a
chore: remoção dos console.log()
MrErykCardoso Aug 22, 2024
bd3f19a
chore: correção na resposta do catch aggregate error
MrErykCardoso Aug 25, 2024
6add6d8
fix: correção para requisição da task, cadastro é permitido apenas co…
MrErykCardoso Aug 28, 2024
ce01089
fix: atraso no carregamento da função configDotenv
MrErykCardoso Aug 28, 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
25 changes: 24 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
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: 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}}
4 changes: 2 additions & 2 deletions docker/postgres/projeto-final-ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ CREATE TABLE "follows" (
);

CREATE TABLE "users" (
"id" integer PRIMARY KEY,
"id" serial PRIMARY KEY,
"username" varchar NOT NULL,
"password" varchar NOT NULL,
"created_at" timestamp NOT NULL DEFAULT 'NOW()'
);

CREATE TABLE "posts" (
"id" integer PRIMARY KEY NOT NULL,
"id" serial PRIMARY KEY NOT NULL,
"title" varchar NOT NULL,
"body" text NOT NULL,
"user_id" integer NOT NULL,
Expand Down
27 changes: 12 additions & 15 deletions jest.config.mjs
Original file line number Diff line number Diff line change
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 All @@ -77,16 +77,16 @@ const config = {
// ],

// An array of file extensions your modules use
// moduleFileExtensions: [
// "js",
// "mjs",
// "cjs",
// "jsx",
// "ts",
// "tsx",
// "json",
// "node"
// ],
moduleFileExtensions: [
"js",
"mjs",
"cjs",
"jsx",
"ts",
"tsx",
"json",
"node",
],

// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
// moduleNameMapper: {},
Expand Down Expand Up @@ -154,10 +154,7 @@ const config = {
// testLocationInResults: false,

// The glob patterns Jest uses to detect test files
// testMatch: [
// "**/__tests__/**/*.[jt]s?(x)",
// "**/?(*.)+(spec|test).[tj]s?(x)"
// ],
testMatch: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[tj]s?(x)"],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
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