Skip to content

Commit

Permalink
correção erros de lint
Browse files Browse the repository at this point in the history
  • Loading branch information
alanpinhel committed Jan 27, 2019
1 parent 06afdd2 commit 91f2127
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import Alimento from './alimento';

export default class AlimentometroWrapper {
getAlimentos() {
return require('../data/alimentos.json').map((a) =>
static getAlimentos() {
/* eslint-disable global-require */
return require('../data/alimentos.json').map(a =>
new Alimento(a.id, a.nome, a.fatorCorrecao, a.indiceConversao));
}
}
12 changes: 3 additions & 9 deletions tests/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@ import { expect } from 'chai';
import mock from 'mock-require';

import Alimento from '../src/alimento';
import AlimentometroWrapper from '../src/index';
import aw from '../src/index';

describe('AlimentometroWrapper', () => {
it('deve criar uma instância de AlimentometroWrapper', () => {
expect(new AlimentometroWrapper()).to.be.an.instanceOf(AlimentometroWrapper);
});

it('getAlimentos() deve retornar uma lista de instâncias de Alimento', () => {
mock('../data/alimentos.json', [{}, {}]);

const alimentos = new AlimentometroWrapper().getAlimentos();

expect(alimentos).to.length(2);
alimentos.forEach(alimento => expect(alimento).to.be.an.instanceOf(Alimento));
expect(aw.getAlimentos()).to.length(2);
aw.getAlimentos().forEach(alimento => expect(alimento).to.be.an.instanceOf(Alimento));
});
});

0 comments on commit 91f2127

Please sign in to comment.