Skip to content

Instantly share code, notes, and snippets.

View CastilloDev1's full-sized avatar

Fabian Andres Castillo CastilloDev1

View GitHub Profile
@CastilloDev1
CastilloDev1 / pasos-node-ts-jest.md
Created November 4, 2024 22:42 — forked from Klerith/pasos-node-ts-jest.md
Note + TypeScript + Jest = Testing

Pasos para configurar Jest con TypeScript, en Node

Documentación oficial sobre Jest

  1. Instalaciones de desarrollo (super test es útil para probar Express)
npm install -D jest @types/jest ts-jest supertest
@CastilloDev1
CastilloDev1 / composition-class.ts
Last active June 28, 2024 15:31
Algunos principios que seguir a la hora de ser legible.
(() => {
// Aplicando el principio de responsabilidad única
// Priorizar la composición frente a la herencia!
type Gender = 'M'|'F';
interface PersonProps {
birthdate : Date;
gender : Gender;
@CastilloDev1
CastilloDev1 / testing.spec.ts
Last active June 28, 2024 13:03
Prueba unitaria que valida y compara propiedades de un custom exception
// Primera forma: Siempre que el catch devuelva un New Error...
describe('createException', () => {
test('should create exception successfully', async () => {
const errorMock: object = null;
const customerAccListMock: object = null;
const responsServiceMock: object = null;
const prueba: Promise<void> = service.createException(errorMock, customerAccListMock, responsServiceMock);
await expect(async() => await prueba ).rejects.toBeInstanceOf(BusinessException);
await expect(async() => await prueba ).rejects.toMatchObject({
@CastilloDev1
CastilloDev1 / instalaciones-node.md
Created June 22, 2024 15:32 — forked from Klerith/instalaciones-node.md
Instalaciones recomendadas - Curso de Node de cero a experto
@CastilloDev1
CastilloDev1 / buenas-practicas-sql.md
Last active June 19, 2024 21:11
Buenas practicas sql - postgresql

postgresql Logo

best practices SQL - PostgreSQL

  • Preguntarnos que debe hacer la base de datos.
  • Cuál es el objetivo de está misma?
  • Al leer sus tablas debe indicarnos el tipo de proyecto que es.
@CastilloDev1
CastilloDev1 / medium-dbdiagram.txt
Last active June 14, 2024 13:29
Usando DBML (DataBase Markup Language) para la creación de bases de datos. (Usar dbdiagram.io para verlo graficamente)
Table users {
user_id integer [pk, increment]
username varchar [not null, unique]
email varchar [not null, unique]
password varchar [not null]
name varchar [not null]
role varchar [not null]
gender varchar(10) [not null]
avatar varchar