All files / test BoxTest.js

95.24% Statements 20/21
50% Branches 1/2
100% Functions 7/7
95.24% Lines 20/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36    1x 1x         1x 1x   1x   1x 1x 1x 1x   1x 1x 1x 1x       1x 1x 1x 1x   1x 1x 1x      
let expect;
 
Eif (typeof require !== 'undefined') { // Execution in node
  expect = require('chai').expect;
} else { // Execution in browser
  expect = chai.expect;
}
 
import Box from '../scripts/Box.js';
import Point from '../scripts/Point.js';
 
describe('Clase Box tests', ()=>{
 
  describe('Comportamiento del constructor', ()=>{
    it('Debería generar un objeto Box', () => {
      let BoxTest = new Box();
      expect(BoxTest).to.be.a('Object');
    });
    it('Debería tener los siguientes atriburos miembro:', () => {
      let BoxTest = new Box();
      expect(BoxTest).to.have.property('id');
      expect(BoxTest).to.have.property('element');
    });
  });
 
  describe('Métodos de la clase', () => {
    it ('Tiene que tener un método para poder dibujar un Box', () => {
      let BoxTest = new Box();
      expect(BoxTest.draw).to.exist;
    });
    it ('draw tiene que poder ser ejecutado sin errores', () => {
      let BoxTest = new Box();
      expect(BoxTest.draw()).not.to.throw;
    });
  });
});