-
Notifications
You must be signed in to change notification settings - Fork 11
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
Teste Unitário resolveProfessor.spec.js #110
base: master
Are you sure you want to change the base?
Changes from all commits
ed506ff
87d4107
91d89d4
047d249
b62c89e
c57d0ee
dc8338d
2c872a7
658f4cc
2594644
99e2b1f
b14f074
e1b4587
99918b7
534e7f5
4b6cadd
ff46033
d9fe8e7
ee51b67
7ca1f4a
a46ab13
c7ff06d
3bf271c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Coverage | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
env: | ||
CODECOV_TOKEN: 613992d7-a6fc-4f73-8b0f-bfbe632ff352 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Install and Run Yarn | ||
run: npm install -g yarn && cd app && yarn | ||
|
||
- name: Install NYC | ||
run: npm install -D nyc --save-dev -g | ||
|
||
- name: Start Docker Containers | ||
run: cd app && docker-compose -f "docker-compose.yaml" up -d --build | ||
|
||
- name: Install Dependendcies | ||
run: cd app && yarn install | ||
|
||
- name: Run Tests and Generate Coverage Report | ||
run: cd app && nyc npm run test && nyc report --reporter=text-lcov > coverage.lcov | ||
|
||
- name: Codecov | ||
uses: codecov/codecov-action@v2 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
flags: unittests | ||
files: ./app/coverage.lcov | ||
|
||
- name: Stop Docker Containers | ||
run: cd app && docker-compose -f "docker-compose.yaml" down |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const assert = require('assert') | ||
const resolveProfessor = require('./resolveProfessor.js') | ||
|
||
describe('helpers.transform.resolveProfessor', function() { | ||
|
||
it('Should return Missing Teacher error', function () { | ||
const professor = {'name': 'Paulo Meirelles'} | ||
const profProcurado = {'name': 'Joaquin Melo'} | ||
|
||
assert.throws(function() { | ||
resolveProfessor(profProcurado, professor, {}) | ||
}) | ||
}) | ||
|
||
it('Should return null', function () { | ||
const nullVariable = resolveProfessor('Falso', null, {}) | ||
assert.equal(nullVariable, null) | ||
}) | ||
|
||
it('Should return a professor ', function () { | ||
const professores = [ | ||
{name: 'Paulo Meirelles'}, {name: 'Joaquin Melo'}, | ||
{name: 'Fabio Carneiro'}, {name: 'Andre Rodrigues'}, | ||
{name: 'Igor Mourão'}, {name: 'Bruno Cruz'}] | ||
|
||
const profProcurado = 'Joaquin Melo' | ||
|
||
const profRetornado = resolveProfessor(profProcurado, professores, {}) | ||
|
||
assert.equal(profRetornado.name, 'Joaquin Melo') | ||
}) | ||
|
||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const assert = require('assert') | ||
const transformMatriculas = require('./transformMatriculas.js') | ||
|
||
describe('helpers.transform.transformMatriculas ', function() { | ||
|
||
it('Should concat student id in class', function () { | ||
const disciplinas = { | ||
'11066615': ['Funções de Uma Variável', 'Processamento da Informação', | ||
'Engenharia de Software', 'Física Quântica'], | ||
'11075416': ['Funções de Uma Variável', 'Processamento da Informação', | ||
'Laboratório de Engenharia de Software', 'Fenônomenos Eletromagnéticos'], | ||
'11000114': ['Funções de Uma Variável', 'Materiais e Suas Propriedades', | ||
'Teoria dos Grafos']} | ||
|
||
const matriculas = transformMatriculas(disciplinas) | ||
|
||
assert.equal(matriculas['Funções de Uma Variável'].length, 3) | ||
assert.equal(matriculas['Processamento da Informação'].length, 2) | ||
assert.equal(matriculas['Laboratório de Engenharia de Software'].length, 1) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,59 @@ | ||||||
const assert = require('assert') | ||||||
|
||||||
const teachers = require('./teachers') | ||||||
|
||||||
describe('teachers', function () { | ||||||
it('should return empty list when has not errors', function () { | ||||||
const disciplinas = [ | ||||||
{ | ||||||
teoria: { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Expected indentation of 8 spaces but found 12.
Suggested change
|
||||||
name: 'Vanessa Kruth', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Expected indentation of 10 spaces but found 16.
Suggested change
|
||||||
error: null, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Expected indentation of 10 spaces but found 16.
Suggested change
|
||||||
}, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Expected indentation of 8 spaces but found 12.
Suggested change
|
||||||
pratica: { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Expected indentation of 8 spaces but found 12.
Suggested change
|
||||||
name: 'Vanessa Kruth', | ||||||
error: null, | ||||||
} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Expected indentation of 8 spaces but found 12.
Suggested change
|
||||||
}, | ||||||
{ | ||||||
teoria: { | ||||||
name: 'Isidro', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Expected indentation of 10 spaces but found 16.
Suggested change
|
||||||
error: null, | ||||||
}, | ||||||
pratica: { | ||||||
name: 'Isidro', | ||||||
error: null, | ||||||
} | ||||||
}, | ||||||
]; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Extra semicolon.
Suggested change
|
||||||
|
||||||
assert.equal(0, Array.from(teachers(disciplinas)).length) | ||||||
}) | ||||||
|
||||||
it('should return list with one error', function () { | ||||||
const disciplinas = [ | ||||||
{ | ||||||
teoria: { | ||||||
name: 'Vanessa Kruth', | ||||||
error: null, | ||||||
}, | ||||||
pratica: { | ||||||
name: 'Vanessa Kruth', | ||||||
error: null, | ||||||
} | ||||||
}, | ||||||
{ | ||||||
teoria: { | ||||||
name: 'Isidro', | ||||||
error: 'Sala não encontrada', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Expected indentation of 10 spaces but found 16.
Suggested change
|
||||||
}, | ||||||
pratica: { | ||||||
name: 'Isidro', | ||||||
error: null, | ||||||
} | ||||||
}, | ||||||
]; | ||||||
|
||||||
assert.equal(1, Array.from(teachers(disciplinas)).length) | ||||||
}) | ||||||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Expected indentation of 6 spaces but found 8.