Skip to content

Instantly share code, notes, and snippets.

View vqc1909a's full-sized avatar
馃彔
Working from home

Victor Cesar Quispe Atencio vqc1909a

馃彔
Working from home
View GitHub Profile
@vqc1909a
vqc1909a / CHEAT_SHEET_TLR.md
Last active October 13, 2025 06:59
CHEAT_SHEET_TLR.md

CHEAT SHEET TESTING LIBRARY REACT

Testing Library React is a library that allows us to test React components in a more user-friendly way, simulating the behavior of a user interacting with the component.

  1. Here we have all the objects of the @testing-library/react package
Object Description Example
render is used to render the component in a virtual DOM, so we can test it without having to render it in the real DOM. const {container} = render(<CounterApp value={initialValue} />);
expect(container).toMatchSnapshot();
screen is a global object that contains all the queries that we can use to get the elements of the component rendered previously with render. render(``); expect(screen.getByText(initialValue)).toBeTruthy();
@vqc1909a
vqc1909a / CHEAT_SHEET_JEST.md
Last active October 13, 2025 06:59
CHEAT_SHEET_JEST.md

CHEAT SHEET JEST

Jest is a JavaScript testing framework that runs in a Node.js environment, so, if you use versions below 18, probably you need to set additional configures in the file jest.config.js because not recognized me the sentence fetch in versions below 18 to the execute the tests, otherwise is not neccesary to configure nothing.

  1. Here we have all the methods of the sentence expect that i've gotten

    NOTE: the .not modifier is used to negate an assertion. It allows you to test that something does not meet a specific condition. You can chain .not before any Jest matcher to invert its behavior.

       expect('team').not.toMatch(/I/)
@vqc1909a
vqc1909a / instalaciones-next.md
Created May 30, 2024 16:06 — forked from Klerith/instalaciones-next.md
Instalaciones recomendadas para el curso de Next.js 13 >
@vqc1909a
vqc1909a / SETUP_JEST_IN_VITE_REACT_PROJECT_WITH_JAVASCRIPT.md
Last active October 13, 2025 07:01
Setup vite react project with javascript

Instalaci贸n y configuracion de Jest + React Testing Library

En proyectos de React + Vite

  1. Instalaciones:

    yarn add -D @babel/core @babel/preset-env @babel/preset-react jest babel-jest react-test-renderer @types/jest @testing-library/react @testing-library/dom @testing-library/jest-dom @testing-library/user-event jest-environment-jsdom
  2. Opcional: Si usamos Fetch API en el proyecto:

@vqc1909a
vqc1909a / instalaciones.md
Last active March 10, 2024 02:21 — forked from Klerith/instalaciones.md
Instalaciones recomendadas para el curso de React Pro
@vqc1909a
vqc1909a / SETUP_JEST_VITE_REACT_PROJECT_WITH_TYPESCRIPT.md
Last active August 24, 2025 03:22
Steps to set up jest in vite react project with typescript

Steps to set up jest in vite react project with typescript

  1. Packages to install to work with javascript

    yarn add -D @babel/core @babel/preset-env @babel/preset-react @babel/preset-typescript jest babel-jest @types/jest @testing-library/react @testing-library/dom @testing-library/jest-dom @testing-library/user-event jest-environment-jsdom react-test-renderer
  2. Packages to install to work with typescript