From 2c6b6912d3d08d88b12ac907cf4ec7fa4c889502 Mon Sep 17 00:00:00 2001 From: Diego Cruz <18170307@itculiacan.edu.mx> Date: Tue, 21 May 2024 09:28:25 -0700 Subject: [PATCH 1/3] cleanup logs --- src/loaders/sequelize.ts | 3 +-- tests/unit/controllers/authController.spec.ts | 6 ------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/loaders/sequelize.ts b/src/loaders/sequelize.ts index 0a3385e..b8a23c0 100644 --- a/src/loaders/sequelize.ts +++ b/src/loaders/sequelize.ts @@ -15,8 +15,7 @@ const sequelizeLoader = async () => { dialect: "mysql", } ); - console.log(config.database.mysql); - + await sequelize.authenticate(); diff --git a/tests/unit/controllers/authController.spec.ts b/tests/unit/controllers/authController.spec.ts index 1e225a8..bceae0c 100644 --- a/tests/unit/controllers/authController.spec.ts +++ b/tests/unit/controllers/authController.spec.ts @@ -17,7 +17,6 @@ describe('Auth Controller', () => { .post('/api/auth/login') .send({}); - console.log(response.body); expect(response.status).toBe(400); expect(response.body).toHaveProperty('message', "email is required, contrasena is required"); @@ -39,7 +38,6 @@ describe('Auth Controller', () => { .post('/api/auth/register') .send(user); - console.log(response.body); expect(response.status).toBe(200); expect(response.body).toHaveProperty('message', 'Registro exitoso'); @@ -51,7 +49,6 @@ describe('Auth Controller', () => { .post('/api/auth/login') .send({ email: user.email, contrasena: user.contrasena }); - console.log(response.body); expect(response.status).toBe(200); expect(response.body).toHaveProperty('message', 'Inicio de sesion exitoso'); @@ -68,7 +65,6 @@ describe('Auth Controller', () => { contrasena: '22222222222275f6tuyibinj', }); - console.log(response.body); expect(response.status).toBe(400); expect(response).toHaveProperty('error'); @@ -99,8 +95,6 @@ describe('Auth Controller', () => { contrasena: 'testpassword', }); - console.log(response.body); - expect(response.status).toBe(400); expect(response).toHaveProperty('error'); expect(response.body).toHaveProperty('message', 'email must be a valid email'); From d8c2be7d6aa4c76b02e893ad204e6914cbf80ec7 Mon Sep 17 00:00:00 2001 From: Diego Cruz <18170307@itculiacan.edu.mx> Date: Tue, 21 May 2024 10:03:03 -0700 Subject: [PATCH 2/3] actions v3 to v4 --- .github/workflows/node.js.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index ba3b883..9d47364 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -14,10 +14,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "20" From 78711fbf95ff1bf2c305ac2ffcdd1b70eb4baeac Mon Sep 17 00:00:00 2001 From: Diego Cruz <18170307@itculiacan.edu.mx> Date: Tue, 21 May 2024 10:45:06 -0700 Subject: [PATCH 3/3] Add cache to workflow --- .github/workflows/node.js.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 9d47364..6d8ced2 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -16,6 +16,14 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Set up Node.js uses: actions/setup-node@v4 with: @@ -47,10 +55,18 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "20" @@ -63,7 +79,12 @@ jobs: - name: Initialize database run: | - docker exec -i $(docker ps -q --filter "ancestor=mysql:8.0") mysql -uroot -prootpassword test < ./dbscripts/mysql.sql + if docker exec -i $(docker ps -q --filter "ancestor=mysql:8.0") mysql -uroot -prootpassword test < ./dbscripts/mysql.sql; then + echo "Database initialized successfully"; + else + echo "Database initialization failed"; + exit 1; + fi - name: Run tests env: