const chai = require('chai');
const assert = chai.assert;

const Skier = require('../app/lib/skier');

describe('Skier', function () {
  beforeEach(function () {
    this.canvas = document.createElement('canvas');
    this.canvas.width = 600;
    this.canvas.height = 500;
    this.context = this.canvas.getContext('2d');
  });

  it('should be an object', function() {
    let skier = new Skier({ canvas: this.canvas, context: this.context});
    assert.isObject(skier);
  });

  it('should have an X-coordinate', function() {
    let skier = new Skier({ canvas: this.canvas, context: this.context});
    assert.ok(skier.x);
  });

  it('should have a Y-coordinate', function() {
    let skier = new Skier({ canvas: this.canvas, context: this.context});
    assert.ok(skier.y);
  });

  it('should have a width', function() {
    let skier = new Skier({ canvas: this.canvas, context: this.context});
    assert.ok(skier.width);
  });

  it('should have a height', function() {
    let skier = new Skier({ canvas: this.canvas, context: this.context});
    assert.ok(skier.height);
  });

  it('should have five lives', function() {
    let skier = new Skier({ canvas: this.canvas, context: this.context});
    assert.strictEqual(skier.lives, 5);
  });

  describe('moveLeft', function() {
    it('should move the skier left', function() {
      let skier = new Skier({ canvas: this.canvas, context: this.context});
      let skier2 = skier.moveLeft();
      assert.isTrue(skier2.x < skier.maxWidth/2);
    });
  });

  describe('moveRight', function() {
    it('should move the skier right', function() {
      let skier = new Skier({ canvas: this.canvas, context: this.context});
      let skier2 = skier.moveRight();
      assert.isTrue(skier2.x > skier.maxWidth/2);
    });
  });

});

@@ -429,32 +429,33 @@
 this.context%7D);%0A
+%0A
     assert.isObj
@@ -588,32 +588,33 @@
 this.context%7D);%0A
+%0A
     assert.ok(sk
@@ -742,32 +742,33 @@
 this.context%7D);%0A
+%0A
     assert.ok(sk
@@ -889,32 +889,33 @@
 this.context%7D);%0A
+%0A
     assert.ok(sk
@@ -1041,32 +1041,33 @@
 this.context%7D);%0A
+%0A
     assert.ok(sk
@@ -1200,24 +1200,25 @@
 .context%7D);%0A
+%0A
     assert.s
@@ -1244,32 +1244,758 @@
 ves, 5);%0A  %7D);%0A%0A
+  it('should not be crashed by default', function () %7B%0A    let skier = new Skier(%7B canvas: this.canvas, context: this.context%7D);%0A%0A    assert.strictEqual(skier.crashed, false);%0A  %7D);%0A%0A  it('should have a distance', function() %7B%0A    let skier = new Skier(%7B canvas: this.canvas, context: this.context%7D);%0A%0A    assert.ok(skier.distance);%0A  %7D);%0A%0A  it('should not be turning left by default', function () %7B%0A    let skier = new Skier(%7B canvas: this.canvas, context: this.context%7D);%0A%0A    assert.strictEqual(skier.turningLeft, false);%0A  %7D);%0A%0A  it('should not be turning right by default', function () %7B%0A    let skier = new Skier(%7B canvas: this.canvas, context: this.context%7D);%0A%0A    assert.strictEqual(skier.turningRight, false);%0A  %7D);%0A%0A
   describe('move
@@ -2173,24 +2173,25 @@
 moveLeft();%0A
+%0A
       assert
@@ -2399,32 +2399,32 @@
 this.context%7D);%0A
-
       let skier2
@@ -2445,16 +2445,17 @@
 ight();%0A
+%0A
       as

Add more unit tests to skier