Why do my Jasmine specs say "No specs found"

My Javascript Function

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

My specification

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);
  });
});
+4
source share
1 answer

There is no comma in the specification after one of the parameters, and therefore should be:

beforeEach(function() {
  this.stock = new Stock();
  this.investment = new Investment({
    stock: this.stock,
    shares: 100,  <-- needs a comma here
    cost: 2000
  });
});
+1
source

Source: https://habr.com/ru/post/1652988/


All Articles