Commit 18f7315a by Clinton Blackburn

Merge pull request #285 from edx/clintonb/test-wrap

Properly wrapping tests
parents 1096ba34 1cd050f9
...@@ -25,6 +25,7 @@ define([ ...@@ -25,6 +25,7 @@ define([
collection = new CourseCollection(); collection = new CourseCollection();
}); });
describe('Course collection', function () {
describe('parse', function () { describe('parse', function () {
it('should return the results list in the response', function () { it('should return the results list in the response', function () {
expect(collection.parse(response)).toEqual(response.results); expect(collection.parse(response)).toEqual(response.results);
...@@ -39,5 +40,6 @@ define([ ...@@ -39,5 +40,6 @@ define([
expect(collection.fetch).toHaveBeenCalledWith({remove: false}); expect(collection.fetch).toHaveBeenCalledWith({remove: false});
}); });
}); });
});
} }
); );
...@@ -98,6 +98,7 @@ define([ ...@@ -98,6 +98,7 @@ define([
model = Course.findOrCreate(data, {parse: true}); model = Course.findOrCreate(data, {parse: true});
}); });
describe('Course model', function () {
describe('removeParentProducts', function () { describe('removeParentProducts', function () {
it('should remove all parent products from the products collection', function () { it('should remove all parent products from the products collection', function () {
var products = model.get('products'); var products = model.get('products');
...@@ -217,5 +218,6 @@ define([ ...@@ -217,5 +218,6 @@ define([
expect(model.get('products')).toEqual(jasmine.any(ProductCollection)); expect(model.get('products')).toEqual(jasmine.any(ProductCollection));
}); });
}); });
});
} }
); );
...@@ -36,6 +36,7 @@ define([ ...@@ -36,6 +36,7 @@ define([
model = CourseSeat.findOrCreate(data, {parse: true}); model = CourseSeat.findOrCreate(data, {parse: true});
}); });
describe('Course seat model', function () {
describe('getSeatType', function () { describe('getSeatType', function () {
it('should return a seat type corresponding to the certificate type', function () { it('should return a seat type corresponding to the certificate type', function () {
var mappings = { var mappings = {
...@@ -113,5 +114,6 @@ define([ ...@@ -113,5 +114,6 @@ define([
}); });
}); });
}); });
});
} }
); );
...@@ -36,6 +36,7 @@ define([ ...@@ -36,6 +36,7 @@ define([
model = Product.findOrCreate(data, {parse: true}); model = Product.findOrCreate(data, {parse: true});
}); });
describe('Product model', function () {
// NOTE (CCB): There is a bug preventing this from being called 'toJSON'. // NOTE (CCB): There is a bug preventing this from being called 'toJSON'.
// See https://github.com/karma-runner/karma/issues/1534. // See https://github.com/karma-runner/karma/issues/1534.
describe('#toJSON', function () { describe('#toJSON', function () {
...@@ -72,5 +73,6 @@ define([ ...@@ -72,5 +73,6 @@ define([
expect(json.attribute_values).toEqual(data.attribute_values); expect(json.attribute_values).toEqual(data.attribute_values);
}); });
}); });
});
} }
); );
...@@ -16,6 +16,7 @@ define([ ...@@ -16,6 +16,7 @@ define([
VerifiedSeat) { VerifiedSeat) {
'use strict'; 'use strict';
describe('CourseUtils', function () {
describe('getCourseSeatModel', function () { describe('getCourseSeatModel', function () {
it('should return the CourseSeat child class corresponding to a seat type', function () { it('should return the CourseSeat child class corresponding to a seat type', function () {
expect(CourseUtils.getCourseSeatModel('audit')).toEqual(AuditSeat); expect(CourseUtils.getCourseSeatModel('audit')).toEqual(AuditSeat);
...@@ -41,5 +42,6 @@ define([ ...@@ -41,5 +42,6 @@ define([
}); });
}); });
}); });
});
} }
); );
...@@ -4,6 +4,7 @@ define([ ...@@ -4,6 +4,7 @@ define([
function (Utils) { function (Utils) {
'use strict'; 'use strict';
describe('Utils', function () {
describe('stripTimezone', function () { describe('stripTimezone', function () {
it('should return the input value if the input is empty', function () { it('should return the input value if the input is empty', function () {
expect(Utils.stripTimezone('')).toEqual(''); expect(Utils.stripTimezone('')).toEqual('');
...@@ -29,5 +30,6 @@ define([ ...@@ -29,5 +30,6 @@ define([
expect(Utils.restoreTimezone(dt)).toEqual(dt + '+00:00'); expect(Utils.restoreTimezone(dt)).toEqual(dt + '+00:00');
}); });
}); });
});
} }
); );
...@@ -13,11 +13,13 @@ define([ ...@@ -13,11 +13,13 @@ define([
view = new CourseSeatFormFieldView({model: model}); view = new CourseSeatFormFieldView({model: model});
}); });
describe('course seat form field view', function () {
describe('cleanIdVerificationRequired', function () { describe('cleanIdVerificationRequired', function () {
it('should always return a boolean', function () { it('should always return a boolean', function () {
expect(view.cleanIdVerificationRequired('false')).toEqual(false); expect(view.cleanIdVerificationRequired('false')).toEqual(false);
expect(view.cleanIdVerificationRequired('true')).toEqual(true); expect(view.cleanIdVerificationRequired('true')).toEqual(true);
}); });
}); });
});
} }
); );
...@@ -13,6 +13,7 @@ define([ ...@@ -13,6 +13,7 @@ define([
view = new CourseSeatFormFieldView({model: model}).render(); view = new CourseSeatFormFieldView({model: model}).render();
}); });
describe('professional course seat form field view', function () {
describe('getFieldValue', function () { describe('getFieldValue', function () {
it('should return a boolean if the name is id_verification_required', function () { it('should return a boolean if the name is id_verification_required', function () {
// NOTE (CCB): Ideally _.each should be used here to loop over an array of Boolean values. // NOTE (CCB): Ideally _.each should be used here to loop over an array of Boolean values.
...@@ -26,10 +27,12 @@ define([ ...@@ -26,10 +27,12 @@ define([
expect(view.getFieldValue('id_verification_required')).toEqual(true); expect(view.getFieldValue('id_verification_required')).toEqual(true);
}); });
// NOTE (CCB): This test is flaky (hence it being skipped). Occasionally, calls to the parent class fail. // NOTE (CCB): This test is flaky (hence it being skipped).
// Occasionally, calls to the parent class fail.
xit('should always return professional if the name is certificate_type', function () { xit('should always return professional if the name is certificate_type', function () {
expect(view.getFieldValue('certificate_type')).toEqual('professional'); expect(view.getFieldValue('certificate_type')).toEqual('professional');
}); });
}); });
});
} }
); );
...@@ -13,6 +13,7 @@ define([ ...@@ -13,6 +13,7 @@ define([
view = new VerifiedCourseSeatFormFieldView({model: model}).render(); view = new VerifiedCourseSeatFormFieldView({model: model}).render();
}); });
describe('verified course seat form field view', function () {
describe('getData', function () { describe('getData', function () {
it('should return the data from the DOM/model', function () { it('should return the data from the DOM/model', function () {
var data = { var data = {
...@@ -25,5 +26,6 @@ define([ ...@@ -25,5 +26,6 @@ define([
expect(view.getData()).toEqual(data); expect(view.getData()).toEqual(data);
}); });
}); });
});
} }
); );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment