I am writing a jasmine unit-test for a sub-app module using Backbone.Marionette
Can someone give me some idea, what to test?
The module to test looks like this.
/*global define*/
define([
'app',
'marionette',
'tasks/views/list',
'tasks/views/detailedLayout'
], function (app, Marionette, ListView, DetailedLayout) {
"use strict";
var taskApp = new Marionette.Application({
tasks: function () {
var listView = new ListView();
app.mainColumn.show(listView);
},
taskDetail: function () {
app.rightColumn.show(new DetailedLayout());
this.tasks();
}
});
return taskApp;
});
I will make something like this but I am not sure if this is the the appropriate way:
describe('Task App', function () {
beforeEach(function () {
this.app = taskApp;
});
describe('When loading the application', function () {
it('should be defined the tasks function', function () {
expect(typeof this.app.tasks).toBeDefined();
});
it('should be defined the taskDetail function', function () {
expect(typeof this.app.taskDetail).toBeDefined();
});
});
//app.js
var App = new Marionette.Application();
App.addRegions({
header: '#header',
sidebar: '#sidebar',
mainColumn: '#main-column',
rightColumn: '#right-column'
});
return App;