'use strict';

import Rect from 'flockn/types/rect';

describe('flockn/types/rect', function () {

  it('is a function', function () {
    expect(Rect).to.be.a('function');
  });

  describe('constructor', function () {
    var rect = new Rect();

    it('can be instantiated', function () {
      expect(rect).to.be.a('object');
      expect(rect).to.be.an.instanceOf(Rect);
    });

    it('default values', function() {
      expect(rect.x).to.be.a('number');
      expect(rect.y).to.be.a('number');
      expect(rect.w).to.be.a('number');
      expect(rect.h).to.be.a('number');

      expect(rect.x).to.equal(0);
      expect(rect.y).to.equal(0);
      expect(rect.w).to.equal(0);
      expect(rect.h).to.equal(0);
    });
  });

  describe('#center()', function() {
    var rect = new Rect();

    it('x value should return a number', () => expect(rect.center().x).to.be.a('number'));
    it('y value should return a number', () => expect(rect.center().y).to.be.a('number'));
    it('x value should be 0 if x, y, w and h are 0', () => expect(rect.center().x).to.equal(0));
    it('y value should be 0 if x, y, w and h are 0', () => expect(rect.center().y).to.equal(0));
  });

  describe('#toString()', function() {
    var rect = new Rect();
    var rect2 = new Rect(20, 20, 40, 40);

    it('stringified empty rect', () => expect(rect.toString()).to.equal(JSON.stringify({x: 0, y: 0, w: 0, h: 0})));
    it('stringified custom rect', () => expect(rect2.toString()).to.equal(JSON.stringify({x: 20, y: 20, w: 40, h: 40})));
  });
});

@@ -45,16 +45,60 @@
 s/rect';
+%0Aimport Vector2 from 'flockn/types/vector2';
 %0A%0Adescri
@@ -764,16 +764,416 @@
 %0A    %7D);
+%0A%0A    it('custom values', function() %7B%0A      var rect2 = new Rect(10, 10, 50, 50);%0A%0A      expect(rect2.x).to.be.a('number');%0A      expect(rect2.y).to.be.a('number');%0A      expect(rect2.w).to.be.a('number');%0A      expect(rect2.h).to.be.a('number');%0A%0A      expect(rect2.x).to.equal(10);%0A      expect(rect2.y).to.equal(10);%0A      expect(rect2.w).to.equal(50);%0A      expect(rect2.h).to.equal(50);%0A    %7D);
 %0A  %7D);%0A%0A
@@ -1191,18 +1191,16 @@
 '#center
-()
 ', funct
@@ -1639,18 +1639,16 @@
 toString
-()
 ', funct
@@ -1968,13 +1968,359 @@
 );%0A  %7D);
+%0A%0A  describe('#contains', function() %7B%0A    var rect = new Rect(0, 0, 20, 20);%0A    var rect2 = new Rect(50, 50, 30, 30);%0A    var vector = new Vector2(10, 10);%0A%0A    it('vector contained in rect', () =%3E expect(rect.contains(vector)).to.equal(true));%0A    it('vector not contained in rect', () =%3E expect(rect2.contains(vector)).to.equal(false));%0A  %7D);
 %0A%7D);%0A

Update rect test