Skip to content

Commit

Permalink
Merge branch 'master' into SFD-54
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrodecf authored Jan 27, 2024
2 parents 771b656 + 11243bd commit f5066e0
Show file tree
Hide file tree
Showing 30 changed files with 1,138 additions and 146 deletions.
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"extends": [
"@rocketseat/eslint-config/node"
],
"camelcase": "off'"
]
}
34 changes: 34 additions & 0 deletions .github/workflows/run-e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run E2E Tests

on: [push]

jobs:
run-e2e-tests:
name: Run E2E Tests
runs-on: ubuntu-latest

services:
postgres:
image: bitnami/postgresql
ports:
- 8080:5432
env:
POSTGRESQL_USERNAME: docker
POSTGRESQL_PASSWORD: docker
POSTGRESQL_DATABASE: orange-db

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4

- run: pnpm install
- run: pnpm prisma generate

- run: pnpm run test:e2e

env:
DATABASE_URL: "postgresql://docker:docker@localhost:8080/orange-db?schema=public"

22 changes: 22 additions & 0 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Run Unit Tests

on: [push]

jobs:
run-unit-tests:
name: Run Unit Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'

- run: pnpm install

- run: pnpm run test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
.env
coverage
coverage

prisma/vitest-environment-prisma/pnpm-lock.yaml
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,42 @@ $ cd orange-back
# Instale as dependências
$ pnpm install


# Subir o container do Docker com banco de dados
$ docker compose up -d


# Crie as variáveis de ambiente, um arquivo .env na raiz do projeto.
$ Veja o exemplo no arquivo ./env.example

# Gere o client do Prisma
$ pnpm prisma generate


# Execute as Migrations
$ pnpx prisma migrate dev


# Execute a aplicação em modo de desenvolvimento
$ pnpm run dev

# O servidor inicicará na porta:3333 - acesse <http://localhost:3333>


## Rodando os testes

# Voce pode rodar os teste unitários nos seguinte scripts:

$ pnpm run test
$ pnpm run test:watch
$ pnpm run test:coverage

# A aplicaçao também conta com teste e2e
# É necessário fazer o setup dos testes e2e antes;

$ pnpm run pretest:e2e

# Rodando os teste e2e
$ pnpm run test:e2e

```
22 changes: 16 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,28 @@
"main": "index.js",
"scripts": {
"dev": "tsx watch src/server.ts",
"test:coverage": "vitest run --coverage",
"test": "vitest run",
"test:watch": "vitest"
"test": "vitest run --dir src/use-cases",
"test:create-prisma-environment": "pnpm link ./prisma/vitest-environment-prisma",
"test:install-prisma-environment": "pnpm link vitest-environment-prisma",
"test:watch": "vitest --dir src/use-cases",
"pretest:e2e": "run-s test:create-prisma-environment test:install-prisma-environment",
"test:e2e": "vitest run --dir src/controller",
"test:e2e:coverage": "vitest run --dir src/controller --coverage",
"test:e2e:watch": "vitest --dir src/controller",
"test:coverage": "vitest run --coverage"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@rocketseat/eslint-config": "^2.1.0",
"@types/node": "^20.11.5",
"@types/node": "^20.11.6",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.2.1",
"eslint": "8.52.0",
"npm-run-all": "^4.1.5",
"prisma": "5.8.1",
"supertest": "^6.3.4",
"tsup": "^8.0.1",
"tsx": "^4.7.0",
"typescript": "^5.3.3",
Expand All @@ -30,10 +39,11 @@
"@types/bcryptjs": "^2.4.6",
"@types/express": "^4.17.21",
"bcryptjs": "^2.4.3",
"dotenv": "^16.3.2",
"dotenv": "^16.4.1",
"fastify": "^4.25.2",
"pg": "^8.11.3",
"pg-hstore": "^2.3.4",
"vite-tsconfig-paths": "^4.3.1",
"zod": "^3.22.4"
}
}
}
Loading

0 comments on commit f5066e0

Please sign in to comment.