Book Image

JavaScript Mobile Application Development

Book Image

JavaScript Mobile Application Development

Overview of this book

Table of Contents (15 chapters)
JavaScript Mobile Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Jasmine Matchers


In the first Jasmine example, we used the toEqual and toThrow Jasmine Matchers. In the following table, some of the other built-in matchers provided by Jasmine are explained briefly:

Matcher

Description

expect(x).toBe(y)

The toBe matcher passes if x is of the same type and value of y. The toBe matcher uses === to perform this comparison.

expect(x).toBeDefined()

The toBeDefined matcher is used to ensure that x is defined.

expect(x).toBeUndefined()

The toBeUndefined matcher is used to ensure that x is undefined.

expect(x).toBeNull()

The toBeNull matcher is used to ensure that x is null.

expect(x).toBeTruthy()

The toBeTruthy matcher is used to ensure that x is truthy.

expect(x).toBeFalsy()

The toBeFalsy matcher is used to ensure that x is falsy.

expect(x).toContain(y)

The toContain matcher is used to check whether the x string or array value contains y. A valid y value can be a substring of x or an item of x.

expect(x).toBeLessThan(y)

The toBeLessThan...