All files / test ShapeTest.js

96.15% Statements 25/26
50% Branches 1/2
100% Functions 7/7
96.15% Lines 25/26

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 37 38 39 40 41    1x 1x       1x     1x   1x 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 Shape from '../scripts/Shape.js';
 
 
describe('Clase Shape tests', ()=>{
 
  describe('Comportamiento del constructor', ()=>{
    it('Debería generar un objeto Shape', () => {
      let shapeTest = new Shape();
      expect(shapeTest).to.be.a('Object');
    });
    it('Debería tener los siguientes atriburos miembro:', () => {
      let shapeTest = new Shape();
      expect(shapeTest).to.have.property('lineCap');
      expect(shapeTest).to.have.property('fillStyle');
      expect(shapeTest).to.have.property('strokeStyle');
      expect(shapeTest).to.have.property('strokeWidth');
      expect(shapeTest).to.have.property('rotate');
      expect(shapeTest).to.have.property('scale');
      expect(shapeTest).to.have.property('isDiscontinuous');
      expect(shapeTest).to.have.property('distanceDiscontinuous');
    });
  });
 
  describe('Métodos de la clase', () => {
    it ('Tiene que tener un método que pueda empezar un path dentro de un canvas', () => {
      let shapeTest = new Shape();
      expect(shapeTest.baseDraw).to.exist;
    });
    it ('baseDraw tiene que poder ser ejecutado sin errores', () => {
      let shapeTest = new Shape();
      expect(shapeTest.baseDraw()).not.to.throw;
    });
  });
});