{"size": 1516, "ext": "js", "max_stars_repo_path": "spec/IntegrationTest.js", "max_stars_repo_name": "andynho/compara_online_test", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "spec/IntegrationTest.js", "max_issues_repo_name": "andynho/compara_online_test", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "spec/IntegrationTest.js", "max_forks_repo_name": "andynho/compara_online_test", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.9387755102, "max_line_length": 81, "alphanum_fraction": 0.7025065963}
const expect = require('chai').expect;
const CarInsurance = require('../src/model/CarInsurance');
const Product = require('../src/model/products/Product');
const FullCoverage = require('../src/model/products/FullCoverage');
const MegaCoverage = require('../src/model/products/MegaCoverage');
const SpecialFullCoverage = require('../src/model/products/SpecialFullCoverage');
const SuperSell = require('../src/model/products/SuperSell');

const productsAtDayZero = [
  new FullCoverage(2, 0),
  new MegaCoverage(-1, 80),
  new SpecialFullCoverage(15, 20),
  new SuperSell(3, 15),
];

describe("Integration Test", function() {

  const carInsurance = new CarInsurance(productsAtDayZero);

  for (let i = 1; i <= 10; i += 1) {
    carInsurance.updatePrice();
  }

  it("FullCoverage case", function() {
    var fullCoverageObj = carInsurance.products[0];
    expect(fullCoverageObj.price).equal(18);
    expect(fullCoverageObj.sellIn).equal(-8);
  });

  it("MegaCoverage case", function() {
    var megaCoverageObj = carInsurance.products[1];
    expect(megaCoverageObj.price).equal(80);
    expect(megaCoverageObj.sellIn).equal(-1);
  });

  it("SpecialFullCoverage case", function() {
    var specialFullCoverage = carInsurance.products[2];
    expect(specialFullCoverage.price).equal(35);
    expect(specialFullCoverage.sellIn).equal(5);
  });

  it("SuperSell case", function() {
    var superSell = carInsurance.products[3];
    expect(superSell.price).equal(0);
    expect(superSell.sellIn).equal(-7);
  });

});
