Currently, I am following a tutorial on how to test Backbone applications using Jasmine and Sinon. I am attempting to stub out an object, and here is the code I have so far:
define(function(require) {
var sinon = require('sinon');
beforeEach(function() {
this.patientStub = sinon.stub(window, "Patient");
this.model = new Backbone.Model({
id: 5,
title: "Foo"
});
});
});
However, I keep encountering the error
TypeError: Attempted to wrap undefined property Patient as function
. Despite searching online and on Stack Overflow, I have not been able to find a solution. Additionally, just to provide context, here is my directory structure:
Patient -> index.html
karma.conf.js
css ->
js ->
test ->
The object I am attempting to mock is located at js/models/Patient.js. Any guidance or assistance on this matter would be greatly appreciated.