Skip to content

Instantly share code, notes, and snippets.

@Horaddrim
Created August 30, 2018 01:42
Show Gist options
  • Save Horaddrim/f8a479532f8339833f182f7d857c05c4 to your computer and use it in GitHub Desktop.
Save Horaddrim/f8a479532f8339833f182f7d857c05c4 to your computer and use it in GitHub Desktop.
const rickManipulationFuctions = require('./rickManipulation');
const {expect} = require('chai');
const resultados = {
// Aqui só colocamos um Rick que sabemos que é o que a gente quer
validRick: {
name: "Rick Sanchez",
dimension: "C-137",
family: [
{
name: "Morty Smith",
age: 14
},
{
name: "Beth Sanchez",
age: 30
},
{
name: "Jerry Smith",
age: 30
},
{
name: "Summer Smith",
age: 17
}
]
},
// e outro que não é o que a gente quer!
invalidRick: {
name: "Rick Sanchez",
dimension: "J19ζ7",
family: []
},
}
describe('Testando funções de manipulação de Ricks', () => {
describe('Testando a função toCountIfRickHaveAFamily', () => {
it('Deve retornar true se o array de family não for vazio', () => {
const resultado = rickManipulationFuctions
.toCountIfRickHaveAFamily(resultados.validRick);
expect(resultado).to.be.equal(true);
});
it('Deve retornar false se o array de family for vazio', () => {
const resultado = rickManipulationFuctions
.toCountIfRickHaveAFamily(resultados.invalidRick);
expect(resultado).to.be.equal(false);
});
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment