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

Improvements on CI #13

Merged
merged 3 commits into from
May 21, 2024
Merged
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
31 changes: 26 additions & 5 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,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"

Expand Down Expand Up @@ -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"

Expand All @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions src/loaders/sequelize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ const sequelizeLoader = async () => {
dialect: "mysql",
}
);
console.log(config.database.mysql);


await sequelize.authenticate();


Expand Down
6 changes: 0 additions & 6 deletions tests/unit/controllers/authController.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -68,7 +65,6 @@ describe('Auth Controller', () => {
contrasena: '22222222222275f6tuyibinj',
});

console.log(response.body);

expect(response.status).toBe(400);
expect(response).toHaveProperty('error');
Expand Down Expand Up @@ -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');
Expand Down
Loading