Skip to content

Commit

Permalink
Merge pull request #5 from eliasrosa/develop
Browse files Browse the repository at this point in the history
V1.0.0
  • Loading branch information
eliasrosa authored Nov 26, 2023
2 parents 58c3a38 + 3c26310 commit 04fefc5
Show file tree
Hide file tree
Showing 157 changed files with 8,783 additions and 17,320 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
NEXT_PUBLIC_API_KEY=
NEXT_PUBLIC_API_URL=https://api.hgbrasil.com
NEXT_PUBLIC_API_CACHE=force-cache
NEXT_PUBLIC_API_REVALIDATE=3600
8 changes: 7 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"extends": ["next/core-web-vitals", "@rocketseat/eslint-config/react"]
"extends": ["@rocketseat/eslint-config/react", "plugin:@next/next/recommended", "plugin:cypress/recommended"],
"rules" : {
"@typescript-eslint/no-explicit-any": "off"
},
"globals": {
"cy": true
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

src/styles/output.css
.env
32 changes: 0 additions & 32 deletions .old/Card.tsx

This file was deleted.

43 changes: 0 additions & 43 deletions .old/HistoryChart.tsx

This file was deleted.

54 changes: 0 additions & 54 deletions .old/ResultsProviders.tsx

This file was deleted.

46 changes: 0 additions & 46 deletions .old/fiis/[ticket]/page.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions .old/getPVP.ts

This file was deleted.

9 changes: 0 additions & 9 deletions .old/getQuote.ts

This file was deleted.

19 changes: 0 additions & 19 deletions .old/selic/page.tsx

This file was deleted.

46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,50 @@
## Getting Started
## Requisitos
Para executar este projeto, você precisará ter instalado:
- [Node.js - v18](https://nodejs.org/en/)
- [Docker - v24](https://www.docker.com/)

First, run the development server:
## Primeiros Passos

Para começar, instale as dependências e execute o servidor de desenvolvimento:

```bash
npm install
npm run dev
```
Isso iniciará o servidor de desenvolvimento, permitindo que você trabalhe no projeto.

## Executar o Servidor Mock
Para executar o servidor mock, que estará disponível em http://localhost:1080, utilize o seguinte comando:

```bash
docker compose up
```

## Testes Unitários
Para executar os testes unitários, use os comandos a seguir:

```bash
npm run test
npm run test:watch
```

## Testes End-to-End (e2e)
Execute os testes end-to-end com o comando:

```bash
npm run test:e2e
```

## Build da Aplicação
Para gerar o build da aplicação, utilize o seguinte comando:

```bash
npm run build
```

## Análise de Código (Lint)
Para realizar a análise de código e garantir conformidade com as práticas recomendadas, execute:

```bash
npm run lint
```
16 changes: 16 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineConfig } from 'cypress'
import { readFile } from 'fs/promises'

export default defineConfig({
screenshotOnRunFailure: false,
chromeWebSecurity: false,
video: false,

e2e: {
baseUrl: 'http://localhost:3000',
viewportWidth: 1200,
viewportHeight: 800,
},

env: {},
})
23 changes: 23 additions & 0 deletions cypress/e2e/sidebar.spec.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
describe('sidebar', () => {
it('test menu link to home', () => {
cy.visit('/simulator')
cy.acceptTermsOfUse()

cy.get('[href="/"][data-testid="sidebar-menu-item"]')
.should('be.visible')
.click()

cy.url().should('eq', Cypress.config().baseUrl + '/')
})

it('test menu link to simulator', () => {
cy.visit('/')
cy.acceptTermsOfUse()

cy.get('[href="/simulator"][data-testid="sidebar-menu-item"]')
.should('be.visible')
.click()

cy.url().should('eq', Cypress.config().baseUrl + '/simulator')
})
})
20 changes: 20 additions & 0 deletions cypress/e2e/simulator.spec.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
describe('simulator', () => {
it('execute simulation with successfully', () => {
cy.visit('/simulator')
cy.acceptTermsOfUse()

cy.simulate()

cy.get('[data-testid="simulator-total-invested"]')
.should('be.visible')
.should('contain', 'R$ 185.000,00')

cy.get('[data-testid="simulator-total-received"]')
.should('be.visible')
.should('contain', 'R$ 569.588,58')

cy.get('[data-testid="simulator-total-accumulated"]')
.should('be.visible')
.should('contain', 'R$ 754.588,58')
})
})
8 changes: 8 additions & 0 deletions cypress/e2e/suggestions.spec.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// describe('suggestions', () => {
// it('add ticker from suggestions card', () => {
// cy.visit('/')
// cy.acceptTermsOfUse()

// cy.get('[data-testid="suggestions-card"] > :nth-child(1) > button').click()
// })
// })
12 changes: 12 additions & 0 deletions cypress/e2e/term.spec.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
describe('terms of use', () => {
it('show modal', () => {
cy.visit('/')
cy.contains('Termos de uso').should('be.visible')
cy.contains('Aceitar e continuar navegando').should('be.visible')
})

it('accept and close modal', () => {
cy.visit('/')
cy.acceptTermsOfUse()
})
})
Loading

1 comment on commit 04fefc5

@vercel
Copy link

@vercel vercel bot commented on 04fefc5 Nov 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.