O'Reilly logo

NativeScript for Angular Mobile Development by Nathanael J. Anderson, Nathan Walker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Why did it fail?

Let's start by looking at the test initialization, beforeEach; you will see that `mute: false`. Well, next, let's look at the constructor; it basically does this.mute = false and the mute setter then runs down its else path, which is this.volume = this._origVolume. Guess what? this._origVolume has not been set yet, so it sets this.volume = undefined. Now take a look at the volume routine; the new volume comes in undefined, it is set to 1, which overrides our original setting of 5. So, the test Expected 1 to be 5. fails.

Interesting corner case; it wouldn't have happened if we hadn't set mute to false as part of testing the initialization of properties. However this is something we should test, because maybe in one of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required