Jasmine example

A simple example of Jasmine tests using JSFiddle

by Neeraj

HTML

<script src="http://searls.github.io/jasmine-all/jasmine-all-min.js"></script>

JavaScript

var ourDataArray = {
    ControlPanel: {
    CurrentInOrder: 1
    },
    Questions: [{
        Text: "Do we like to test?"
    }, {
        Text: "Do we have to test?"
    }, {
        Text: "Why do we test?"
    }, {
        Text: "When do we test?"
    }]
};

describe("Our data array", function() {
  it("has four items", function() {
    expect(ourDataArray.Questions.length).toBe(4);
  });
});

describe("Our data array", function() {
  it("has two properties", function() {
    expect(Object.keys(ourDataArray).length).toBe(2);
  });
});