...

/

Writing a Sample Test

Writing a Sample Test

Learn how to write tests using Jasmine and Karma and explore Jasmine syntax and Karma setup.

Jasmine first test with Karma

This first test is just here to introduce Jasmine and Karma, not to be any useful test. This is Jasmine, using ES6 syntax, mostly the arrows:

Press + to interact
describe("JavaScript testing", () => {
it("works", () => {
expect(1 + 1).toEqual(2)
})
})

Jasmine’s syntax

  • Jasmine’s syntax is heavily inspired by RSpec, with JavaScript function objects taking Ruby blocks. Like RSpec test suites, Jasmine test suites start with describe. In Jasmine, describe is a
...