Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are my Jasmine specs saying 'No specs found'

My Javascript function is

function Investment (params) {
  var params = params || {};
  this.stock = params.stock;
  this.shares = params.shares
  this.cost = params.cost
};

My spec is

describe("Investment", function() {

  beforeEach(function() {
    this.stock = new Stock();
    this.investment = new Investment({
      stock: this.stock,
      shares: 100
      cost: 2000
    });
  });

  it("should be a stock", function() {
    expect(this.investment.stock).toBe(this.stock);
  });

  it("should have the invested shares quantity", function() {
    expect(this.investment.shares).toEqual(100);
  });

  it("should have a cost", function() {
    expect(this.investment.cost).toEqual(2000);
  });
});
like image 496
Michael Durrant Avatar asked Aug 30 '16 11:08

Michael Durrant


1 Answers

The spec is missing a comma after one of the parameters and so should be:

beforeEach(function() {
  this.stock = new Stock();
  this.investment = new Investment({
    stock: this.stock,
    shares: 100,  <-- needs a comma here
    cost: 2000
  });
});
like image 112
Michael Durrant Avatar answered Oct 21 '22 17:10

Michael Durrant