I am currently using Jasmine ("jasmine": "^2.4.1") with Node v6.1.0
I am both trying to provide and consume multiple modules in one file - however keep getting errors like object undefined or null etc.
I have played around with different syntax styles but can't quite get it right, where am I going wrong?
The documentation is for both Jasmine and RequireJs is just not helping.
In my module I export like this:
function Player() {
}
Player.prototype.play = function(song) {
this.currentlyPlayingSong = song;
this.isPlaying = true;
};
Player.prototype.pause = function() {
this.isPlaying = false;
};
Player.prototype.resume = function() {
if (this.isPlaying) {
throw new Error("song is already playing");
}
this.isPlaying = true;
};
Player.prototype.makeFavorite = function() {
this.currentlyPlayingSong.persistFavoriteStatus(true);
};
module.exports = Player;
function Song() {
}
Song.prototype.persistFavoriteStatus = function(value) {
// something complicated
throw new Error("not yet implemented");
};
module.exports = Song;
And when I consume it in my Spec:
var { Player, Song } = require('../app/example-module');