Skip to content
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

prueba tecnica libreria #99

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_API_URL=http://localhost:5173/books.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_API_URL=https://reading-list-121023d.netlify.app/books.json
22 changes: 22 additions & 0 deletions pruebas/01-reading-list/MoleraDani/reading-list/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-env node */

module.exports = {
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'standard',
'standard-jsx'
],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true }
]
}
}
24 changes: 24 additions & 0 deletions pruebas/01-reading-list/MoleraDani/reading-list/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
32 changes: 32 additions & 0 deletions pruebas/01-reading-list/MoleraDani/reading-list/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Título de la aplicación

Una aplicación de biblioteca de libros implementada con React y Vite.

## Descripción

Esta es una aplicación de biblioteca que muestra una lista de libros disponibles, permite a los usuarios filtrar libros por número de páginas y género, y les permite agregar libros a su lista de lectura personal.

## Instalación
Sigue estos pasos para instalar y correr la aplicación en tu entorno local:

1. Instala las dependencias:


npm install


## Uso

Para correr la aplicación en modo de desarrollo, usa

npm run dev

## Test

Para ejecturar los test usa

npm run cypress:run

## Enlace URL

[Enlace a la app desplegada](https://reading-list-121023d.netlify.app/)
16 changes: 16 additions & 0 deletions pruebas/01-reading-list/MoleraDani/reading-list/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},

component: {
devServer: {
framework: "react",
bundler: "vite",
},
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
describe('Book actions', () => {
beforeEach(() => {
cy.visit('http://localhost:5173')
})

it('adds a book to the reading list', () => {
cy.get('.library-grid li').first().click()
cy.get('.reading-list-aside li').should('have.length', 1)
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
describe('Library', () => {
beforeEach(() => {
cy.visit('http://localhost:5173')
})

it('renders the book list', () => {
cy.get('.library-grid').should('be.visible')
})

it('renders the reading list', () => {
cy.get('.reading-list-aside').should('be.visible')
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// ***********************************************************
// This example support/component.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')

import { mount } from 'cypress/react18'

Cypress.Commands.add('mount', mount)

// Example use:
// cy.mount(<MyComponent />)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Binary file not shown.
Binary file not shown.
13 changes: 13 additions & 0 deletions pruebas/01-reading-list/MoleraDani/reading-list/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
32 changes: 32 additions & 0 deletions pruebas/01-reading-list/MoleraDani/reading-list/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "reading-list",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"e2e": "cypress open",
"cypress:run": "cypress run"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"zustand": "^4.3.9",
"zustand-persist": "^0.4.0"
},
"devDependencies": {
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@vitejs/plugin-react-swc": "^3.3.2",
"cypress": "12.17.1",
"eslint": "^8.44.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.1",
"standard": "^17.1.0",
"vite": "^4.4.0"
}
}
Loading