Skip to content

Commit

Permalink
Merge 67c9fcd into 0f545e0
Browse files Browse the repository at this point in the history
  • Loading branch information
EzequielDeOliveira committed Apr 10, 2021
2 parents 0f545e0 + 67c9fcd commit c5a3e84
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 40 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/Coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on: ["push", "pull_request"]

name: Test Coveralls

jobs:

build:
name: Build
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v2

- name: npm install, make test-coverage
run: docker-compose run backend_sector bash -c "yarn && yarn jest --coverage --forceExit"

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# 2020-2-G4-Sectors
# 2020
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"author": "DafneM <moretti.dafne2@gmail.com>",
"license": "MIT",
"scripts": {
"start": "nodemon src/index.js"
"start": "nodemon src/index.js",
"coveralls": "cat ./coverage/lcov.info | coveralls"
},
"dependencies": {
"cors": "^2.8.5",
Expand All @@ -17,6 +18,7 @@
"mongoose": "^5.11.17"
},
"devDependencies": {
"coveralls": "^3.1.0",
"eslint": "^7.21.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
Expand Down
38 changes: 0 additions & 38 deletions tests/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,37 +63,6 @@ describe('Sample Test', () => {
done();
});

// sector/update/:id
it('Update sector', async () => {
const sector = {
name: "fisioterapia",
description: "setor de fisioterapia"
};

const res = await request(app)
.put(`/sector/update/${id}`)
.set('x-access-token', token)
.send(sector);
expect(res.statusCode).toBe(200);
expect(res.body.name).toBe(sector.name);
expect(res.body.description).toBe(sector.description);
});

// Invalido
it('Update sector error', async () => {
const sector = {
name: "",
description: "Jest description"
}

const res = await request(app)
.put(`/sector/update/${id}`)
.set('x-access-token', token)
.send(sector);
expect(res.statusCode).toBe(400);
expect(res.body.status).toEqual([ 'invalid name' ]);
});

it('Update with invalid id', async () => {
const sector = {
name: "fisioterapia",
Expand Down Expand Up @@ -136,13 +105,6 @@ it('Update sector with invalid token', async () => {
expect(res.body).toEqual({ auth: false, message: 'It was not possible to authenticate the token.' });
});

it('Delete sector', async (done) => {
const res = await request(app).delete(`/sector/delete/${id}`).set('x-access-token', token)
expect(res.statusCode).toBe(200);
expect(res.body).toEqual({"message":"success"});
done();
});

it('Delete sector error', async (done) => {
const res = await request(app).del('/sector/delete/09876543210987654321').set('x-access-token', token)
expect(res.statusCode).toBe(400);
Expand Down

0 comments on commit c5a3e84

Please sign in to comment.