First few unit tests

This commit is contained in:
David Baumgold
2013-06-12 14:03:44 -04:00
parent 40098f6593
commit 001cd5d004
3 changed files with 21 additions and 7 deletions

View File

@@ -32,21 +32,21 @@ from path import path
MITX_FEATURES = {
'USE_DJANGO_PIPELINE': True,
'GITHUB_PUSH': False,
'ENABLE_DISCUSSION_SERVICE': False,
'AUTH_USE_MIT_CERTIFICATES': False,
# do not display video when running automated acceptance tests
'STUB_VIDEO_FOR_TESTING': False,
# email address for staff (eg to request course creation)
'STAFF_EMAIL': '',
'STUDIO_NPS_SURVEY': True,
# Segment.io - must explicitly turn it on for production
'SEGMENT_IO': False,
@@ -242,6 +242,7 @@ PIPELINE_JS = {
) + ['js/hesitate.js', 'js/base.js', 'js/views/feedback.js',
'js/models/section.js', 'js/views/section.js',
'js/models/metadata_model.js', 'js/views/metadata_editor_view.js',
'js/models/textbook.js', 'js/views/textbooks.js',
'js/views/assets.js'],
'output_filename': 'js/cms-application.js',
'test_order': 0

View File

@@ -9,6 +9,7 @@
"js/vendor/underscore-min.js",
"js/vendor/underscore.string.min.js",
"js/vendor/backbone-min.js",
"js/vendor/backbone-associations-min.js",
"js/vendor/jquery.leanModal.min.js",
"js/vendor/sinon-1.7.1.js",
"js/test/i18n.js"

View File

@@ -0,0 +1,12 @@
describe "CMS.Models.Textbook", ->
beforeEach ->
@model = new CMS.Models.Textbook()
it "should have an empty name by default", ->
expect(@model.get("name")).toEqual("")
it "should not show chapters by default", ->
expect(@model.get("showChapters")).toBeFalsy()
it "should have a ChapterSet with one chapter by default", ->
expect(@model.get("chapters").length).toEqual(1)