diff --git a/cms/static/coffee/spec/models/course_spec.js b/cms/static/coffee/spec/models/course_spec.js index 2bdb333f57..ab94fa9381 100644 --- a/cms/static/coffee/spec/models/course_spec.js +++ b/cms/static/coffee/spec/models/course_spec.js @@ -1,19 +1,14 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ define(["js/models/course"], Course => describe("Course", () => describe("basic", function() { beforeEach(function() { - return this.model = new Course({ + this.model = new Course({ name: "Greek Hero" }); }); - return it("should take a name argument", function() { - return expect(this.model.get("name")).toEqual("Greek Hero"); + it("should take a name argument", function() { + expect(this.model.get("name")).toEqual("Greek Hero"); }); }) ) diff --git a/cms/static/coffee/spec/models/metadata_spec.js b/cms/static/coffee/spec/models/metadata_spec.js index dd5bbea0f3..a90c1f2ad6 100644 --- a/cms/static/coffee/spec/models/metadata_spec.js +++ b/cms/static/coffee/spec/models/metadata_spec.js @@ -1,8 +1,3 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ define(["js/models/metadata"], Metadata => describe("Metadata", function() { it("knows when the value has not been modified", function() { @@ -13,7 +8,7 @@ define(["js/models/metadata"], Metadata => model = new Metadata( {'value': 'original', 'explicitly_set': true}); model.setValue('original'); - return expect(model.isModified()).toBeFalsy(); + expect(model.isModified()).toBeFalsy(); }); it("knows when the value has been modified", function() { @@ -25,7 +20,7 @@ define(["js/models/metadata"], Metadata => model = new Metadata( {'value': 'original', 'explicitly_set': true}); model.setValue('modified'); - return expect(model.isModified()).toBeTruthy(); + expect(model.isModified()).toBeTruthy(); }); it("tracks when values have been explicitly set", function() { @@ -33,7 +28,7 @@ define(["js/models/metadata"], Metadata => {'value': 'original', 'explicitly_set': false}); expect(model.isExplicitlySet()).toBeFalsy(); model.setValue('original'); - return expect(model.isExplicitlySet()).toBeTruthy(); + expect(model.isExplicitlySet()).toBeTruthy(); }); it("has both 'display value' and a 'value' methods", function() { @@ -43,7 +38,7 @@ define(["js/models/metadata"], Metadata => expect(model.getDisplayValue()).toBe('default'); model.setValue('modified'); expect(model.getValue()).toBe('modified'); - return expect(model.getDisplayValue()).toBe('modified'); + expect(model.getDisplayValue()).toBe('modified'); }); it("has a clear method for reverting to the default", function() { @@ -52,22 +47,22 @@ define(["js/models/metadata"], Metadata => model.clear(); expect(model.getValue()).toBeNull; expect(model.getDisplayValue()).toBe('default'); - return expect(model.isExplicitlySet()).toBeFalsy(); + expect(model.isExplicitlySet()).toBeFalsy(); }); it("has a getter for field name", function() { const model = new Metadata({'field_name': 'foo'}); - return expect(model.getFieldName()).toBe('foo'); + expect(model.getFieldName()).toBe('foo'); }); it("has a getter for options", function() { const model = new Metadata({'options': ['foo', 'bar']}); - return expect(model.getOptions()).toEqual(['foo', 'bar']); + expect(model.getOptions()).toEqual(['foo', 'bar']); }); - return it("has a getter for type", function() { + it("has a getter for type", function() { const model = new Metadata({'type': 'Integer'}); - return expect(model.getType()).toBe(Metadata.INTEGER_TYPE); + expect(model.getType()).toBe(Metadata.INTEGER_TYPE); }); }) ); diff --git a/cms/static/coffee/spec/models/section_spec.js b/cms/static/coffee/spec/models/section_spec.js index 011099773e..c0c89c2d15 100644 --- a/cms/static/coffee/spec/models/section_spec.js +++ b/cms/static/coffee/spec/models/section_spec.js @@ -7,26 +7,26 @@ define(["js/models/section", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers" describe("Section", function() { describe("basic", function() { beforeEach(function() { - return this.model = new Section({ + this.model = new Section({ id: 42, name: "Life, the Universe, and Everything" }); }); it("should take an id argument", function() { - return expect(this.model.get("id")).toEqual(42); + expect(this.model.get("id")).toEqual(42); }); it("should take a name argument", function() { - return expect(this.model.get("name")).toEqual("Life, the Universe, and Everything"); + expect(this.model.get("name")).toEqual("Life, the Universe, and Everything"); }); it("should have a URL set", function() { - return expect(this.model.url()).toEqual(ModuleUtils.getUpdateUrl(42)); + expect(this.model.url()).toEqual(ModuleUtils.getUpdateUrl(42)); }); - return it("should serialize to JSON correctly", function() { - return expect(this.model.toJSON()).toEqual({ + it("should serialize to JSON correctly", function() { + expect(this.model.toJSON()).toEqual({ metadata: { display_name: "Life, the Universe, and Everything" @@ -35,11 +35,11 @@ define(["js/models/section", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers" }); }); - return describe("XHR", function() { + describe("XHR", function() { beforeEach(function() { spyOn(Section.prototype, 'showNotification'); spyOn(Section.prototype, 'hideNotification'); - return this.model = new Section({ + this.model = new Section({ id: 42, name: "Life, the Universe, and Everything" }); @@ -51,16 +51,16 @@ define(["js/models/section", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers" this.model.save(); expect(Section.prototype.showNotification).toHaveBeenCalled(); server.respond(); - return expect(Section.prototype.hideNotification).toHaveBeenCalled(); + expect(Section.prototype.hideNotification).toHaveBeenCalled(); }); - return it("don't hide notification when saving fails", function() { + it("don't hide notification when saving fails", function() { // this is handled by the global AJAX error handler const server = AjaxHelpers.server([500, {"Content-Type": "application/json"}, "{}"]); this.model.save(); server.respond(); - return expect(Section.prototype.hideNotification).not.toHaveBeenCalled(); + expect(Section.prototype.hideNotification).not.toHaveBeenCalled(); }); }); }) diff --git a/cms/static/coffee/spec/models/settings_course_grader_spec.js b/cms/static/coffee/spec/models/settings_course_grader_spec.js index 1d0ba32d92..b5d856fdda 100644 --- a/cms/static/coffee/spec/models/settings_course_grader_spec.js +++ b/cms/static/coffee/spec/models/settings_course_grader_spec.js @@ -1,8 +1,3 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ define(["js/models/settings/course_grader"], CourseGrader => describe("CourseGraderModel", () => describe("parseWeight", function() { @@ -10,29 +5,29 @@ define(["js/models/settings/course_grader"], CourseGrader => const model = new CourseGrader({weight: 7.0001, min_count: 3.67, drop_count: 1.88}, {parse:true}); expect(model.get('weight')).toBe(7); expect(model.get('min_count')).toBe(4); - return expect(model.get('drop_count')).toBe(2); + expect(model.get('drop_count')).toBe(2); }); it("converts float value of weight to an integer with rounding", function() { const model = new CourseGrader({weight: 28.999999999999996}, {parse:true}); - return expect(model.get('weight')).toBe(29); + expect(model.get('weight')).toBe(29); }); it("converts a string to an integer", function() { const model = new CourseGrader({weight: '7.0001', min_count: '3.67', drop_count: '1.88'}, {parse:true}); expect(model.get('weight')).toBe(7); expect(model.get('min_count')).toBe(4); - return expect(model.get('drop_count')).toBe(2); + expect(model.get('drop_count')).toBe(2); }); it("does a no-op for integers", function() { const model = new CourseGrader({weight: 7, min_count: 3, drop_count: 1}, {parse:true}); expect(model.get('weight')).toBe(7); expect(model.get('min_count')).toBe(3); - return expect(model.get('drop_count')).toBe(1); + expect(model.get('drop_count')).toBe(1); }); - return it("gives validation error if min_count is less than 1 or drop_count is NaN", function() { + it("gives validation error if min_count is less than 1 or drop_count is NaN", function() { const model = new CourseGrader(); let errors = model.validate({min_count: 0, drop_count: ''}, {validate:true}); expect(errors.min_count).toBe('Please enter an integer greater than 0.'); @@ -44,7 +39,7 @@ define(["js/models/settings/course_grader"], CourseGrader => // don't allow floats errors = model.validate({min_count: 12.2, drop_count: 1.5}, {validate:true}); expect(errors.min_count).toBe('Please enter an integer greater than 0.'); - return expect(errors.drop_count).toBe('Please enter non-negative integer.'); + expect(errors.drop_count).toBe('Please enter non-negative integer.'); }); }) ) diff --git a/cms/static/coffee/spec/models/settings_grading_spec.js b/cms/static/coffee/spec/models/settings_grading_spec.js index 6238024fef..f74e5b0797 100644 --- a/cms/static/coffee/spec/models/settings_grading_spec.js +++ b/cms/static/coffee/spec/models/settings_grading_spec.js @@ -1,8 +1,3 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ define(["underscore", "js/models/settings/course_grading_policy"], (_, CourseGradingPolicy) => describe("CourseGradingPolicy", function() { beforeEach(function() { @@ -12,7 +7,7 @@ define(["underscore", "js/models/settings/course_grading_policy"], (_, CourseGra describe("parse", () => it("sets a null grace period to 00:00", function() { const attrs = this.model.parse({grace_period: null}); - return expect(attrs.grace_period).toEqual({ + expect(attrs.grace_period).toEqual({ hours: 0, minutes: 0 }); @@ -22,30 +17,30 @@ define(["underscore", "js/models/settings/course_grading_policy"], (_, CourseGra describe("parseGracePeriod", function() { it("parses a time in HH:MM format", function() { const time = this.model.parseGracePeriod("07:19"); - return expect(time).toEqual({ + expect(time).toEqual({ hours: 7, minutes: 19 }); }); - return it("returns null on an incorrectly formatted string", function() { + it("returns null on an incorrectly formatted string", function() { expect(this.model.parseGracePeriod("asdf")).toBe(null); expect(this.model.parseGracePeriod("7:19")).toBe(null); - return expect(this.model.parseGracePeriod("1000:00")).toBe(null); + expect(this.model.parseGracePeriod("1000:00")).toBe(null); }); }); - return describe("validate", function() { + describe("validate", function() { it("enforces that the passing grade is <= the minimum grade to receive credit if credit is enabled", function() { this.model.set({minimum_grade_credit: 0.8, grace_period: '01:00', is_credit_course: true}); this.model.set('grade_cutoffs', [0.9], {validate: true}); - return expect(_.keys(this.model.validationError)).toContain('minimum_grade_credit'); + expect(_.keys(this.model.validationError)).toContain('minimum_grade_credit'); }); - return it("does not enforce the passing grade limit in non-credit courses", function() { + it("does not enforce the passing grade limit in non-credit courses", function() { this.model.set({minimum_grade_credit: 0.8, grace_period: '01:00', is_credit_course: false}); this.model.set({grade_cutoffs: [0.9]}, {validate: true}); - return expect(this.model.validationError).toBe(null); + expect(this.model.validationError).toBe(null); }); }); }) diff --git a/cms/static/coffee/spec/models/textbook_spec.js b/cms/static/coffee/spec/models/textbook_spec.js index 75ac6f875a..9be93eb624 100644 --- a/cms/static/coffee/spec/models/textbook_spec.js +++ b/cms/static/coffee/spec/models/textbook_spec.js @@ -1,10 +1,3 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * DS203: Remove `|| {}` from converted for-own loops - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ - define(["backbone", "js/models/textbook", "js/collections/textbook", "js/models/chapter", "js/collections/chapter", "cms/js/main"], function(Backbone, Textbook, TextbookSet, Chapter, ChapterSet, main) { @@ -12,55 +5,55 @@ function(Backbone, Textbook, TextbookSet, Chapter, ChapterSet, main) { beforeEach(function() { main(); this.model = new Textbook(); - return CMS.URL.TEXTBOOKS = "/textbooks"; + CMS.URL.TEXTBOOKS = "/textbooks"; }); afterEach(() => delete CMS.URL.TEXTBOOKS); describe("Basic", function() { it("should have an empty name by default", function() { - return expect(this.model.get("name")).toEqual(""); + expect(this.model.get("name")).toEqual(""); }); it("should not show chapters by default", function() { - return expect(this.model.get("showChapters")).toBeFalsy(); + expect(this.model.get("showChapters")).toBeFalsy(); }); it("should have a ChapterSet with one chapter by default", function() { const chapters = this.model.get("chapters"); expect(chapters).toBeInstanceOf(ChapterSet); expect(chapters.length).toEqual(1); - return expect(chapters.at(0).isEmpty()).toBeTruthy(); + expect(chapters.at(0).isEmpty()).toBeTruthy(); }); it("should be empty by default", function() { - return expect(this.model.isEmpty()).toBeTruthy(); + expect(this.model.isEmpty()).toBeTruthy(); }); it("should have a URL root", function() { const urlRoot = _.result(this.model, 'urlRoot'); - return expect(urlRoot).toBeTruthy(); + expect(urlRoot).toBeTruthy(); }); it("should be able to reset itself", function() { this.model.set("name", "foobar"); this.model.reset(); - return expect(this.model.get("name")).toEqual(""); + expect(this.model.get("name")).toEqual(""); }); it("should not be dirty by default", function() { - return expect(this.model.isDirty()).toBeFalsy(); + expect(this.model.isDirty()).toBeFalsy(); }); it("should be dirty after it's been changed", function() { this.model.set("name", "foobar"); - return expect(this.model.isDirty()).toBeTruthy(); + expect(this.model.isDirty()).toBeTruthy(); }); - return it("should not be dirty after calling setOriginalAttributes", function() { + it("should not be dirty after calling setOriginalAttributes", function() { this.model.set("name", "foobar"); this.model.setOriginalAttributes(); - return expect(this.model.isDirty()).toBeFalsy(); + expect(this.model.isDirty()).toBeFalsy(); }); }); @@ -74,7 +67,7 @@ function(Backbone, Textbook, TextbookSet, Chapter, ChapterSet, main) { return _.map(obj, deepAttributes); } else if (_.isObject(obj)) { const attributes = {}; - for (let prop of Object.keys(obj || {})) { + for (let prop of Object.keys(obj)) { const val = obj[prop]; attributes[prop] = deepAttributes(val); } @@ -84,7 +77,7 @@ function(Backbone, Textbook, TextbookSet, Chapter, ChapterSet, main) { } }; - return it("should match server model to client model", function() { + it("should match server model to client model", function() { const serverModelSpec = { "tab_title": "My Textbook", "chapters": [ @@ -110,20 +103,20 @@ function(Backbone, Textbook, TextbookSet, Chapter, ChapterSet, main) { const model = new Textbook(serverModelSpec, {parse: true}); expect(deepAttributes(model)).toEqual(clientModelSpec); - return expect(model.toJSON()).toEqual(serverModelSpec); + expect(model.toJSON()).toEqual(serverModelSpec); }); }); - return describe("Validation", function() { + describe("Validation", function() { it("requires a name", function() { const model = new Textbook({name: ""}); - return expect(model.isValid()).toBeFalsy(); + expect(model.isValid()).toBeFalsy(); }); it("requires at least one chapter", function() { const model = new Textbook({name: "foo"}); model.get("chapters").reset(); - return expect(model.isValid()).toBeFalsy(); + expect(model.isValid()).toBeFalsy(); }); it("requires a valid chapter", function() { @@ -131,7 +124,7 @@ function(Backbone, Textbook, TextbookSet, Chapter, ChapterSet, main) { chapter.isValid = () => false; const model = new Textbook({name: "foo"}); model.get("chapters").reset([chapter]); - return expect(model.isValid()).toBeFalsy(); + expect(model.isValid()).toBeFalsy(); }); it("requires all chapters to be valid", function() { @@ -141,15 +134,15 @@ function(Backbone, Textbook, TextbookSet, Chapter, ChapterSet, main) { chapter2.isValid = () => false; const model = new Textbook({name: "foo"}); model.get("chapters").reset([chapter1, chapter2]); - return expect(model.isValid()).toBeFalsy(); + expect(model.isValid()).toBeFalsy(); }); - return it("can pass validation", function() { + it("can pass validation", function() { const chapter = new Chapter(); chapter.isValid = () => true; const model = new Textbook({name: "foo"}); model.get("chapters").reset([chapter]); - return expect(model.isValid()).toBeTruthy(); + expect(model.isValid()).toBeTruthy(); }); }); }); @@ -158,80 +151,80 @@ function(Backbone, Textbook, TextbookSet, Chapter, ChapterSet, main) { describe("Textbook collection", function() { beforeEach(function() { CMS.URL.TEXTBOOKS = "/textbooks"; - return this.collection = new TextbookSet(); + this.collection = new TextbookSet(); }); afterEach(() => delete CMS.URL.TEXTBOOKS); - return it("should have a url set", function() { + it("should have a url set", function() { const url = _.result(this.collection, 'url'); - return expect(url).toEqual("/textbooks"); + expect(url).toEqual("/textbooks"); }); }); describe("Chapter model", function() { beforeEach(function() { - return this.model = new Chapter(); + this.model = new Chapter(); }); describe("Basic", function() { it("should have a name by default", function() { - return expect(this.model.get("name")).toEqual(""); + expect(this.model.get("name")).toEqual(""); }); it("should have an asset_path by default", function() { - return expect(this.model.get("asset_path")).toEqual(""); + expect(this.model.get("asset_path")).toEqual(""); }); it("should have an order by default", function() { - return expect(this.model.get("order")).toEqual(1); + expect(this.model.get("order")).toEqual(1); }); - return it("should be empty by default", function() { - return expect(this.model.isEmpty()).toBeTruthy(); + it("should be empty by default", function() { + expect(this.model.isEmpty()).toBeTruthy(); }); }); - return describe("Validation", function() { + describe("Validation", function() { it("requires a name", function() { const model = new Chapter({name: "", asset_path: "a.pdf"}); - return expect(model.isValid()).toBeFalsy(); + expect(model.isValid()).toBeFalsy(); }); it("requires an asset_path", function() { const model = new Chapter({name: "a", asset_path: ""}); - return expect(model.isValid()).toBeFalsy(); + expect(model.isValid()).toBeFalsy(); }); - return it("can pass validation", function() { + it("can pass validation", function() { const model = new Chapter({name: "a", asset_path: "a.pdf"}); - return expect(model.isValid()).toBeTruthy(); + expect(model.isValid()).toBeTruthy(); }); }); }); - return describe("Chapter collection", function() { + describe("Chapter collection", function() { beforeEach(function() { - return this.collection = new ChapterSet(); + this.collection = new ChapterSet(); }); it("is empty by default", function() { - return expect(this.collection.isEmpty()).toBeTruthy(); + expect(this.collection.isEmpty()).toBeTruthy(); }); it("is empty if all chapters are empty", function() { this.collection.add([{}, {}, {}]); - return expect(this.collection.isEmpty()).toBeTruthy(); + expect(this.collection.isEmpty()).toBeTruthy(); }); it("is not empty if a chapter is not empty", function() { this.collection.add([{}, {name: "full"}, {}]); - return expect(this.collection.isEmpty()).toBeFalsy(); + expect(this.collection.isEmpty()).toBeFalsy(); }); - return it("should have a nextOrder function", function() { + it("should have a nextOrder function", function() { expect(this.collection.nextOrder()).toEqual(1); this.collection.add([{}]); expect(this.collection.nextOrder()).toEqual(2); @@ -241,7 +234,7 @@ function(Backbone, Textbook, TextbookSet, Chapter, ChapterSet, main) { expect(this.collection.nextOrder()).toEqual(3); // try going back one this.collection.remove(this.collection.last()); - return expect(this.collection.nextOrder()).toEqual(2); + expect(this.collection.nextOrder()).toEqual(2); }); }); }); diff --git a/cms/static/coffee/spec/models/upload_spec.js b/cms/static/coffee/spec/models/upload_spec.js index 04900f7d7f..f8347dc7cc 100644 --- a/cms/static/coffee/spec/models/upload_spec.js +++ b/cms/static/coffee/spec/models/upload_spec.js @@ -1,89 +1,84 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ define(["js/models/uploads"], FileUpload => describe("FileUpload", function() { beforeEach(function() { - return this.model = new FileUpload(); + this.model = new FileUpload(); }); it("is unfinished by default", function() { - return expect(this.model.get("finished")).toBeFalsy(); + expect(this.model.get("finished")).toBeFalsy(); }); it("is not uploading by default", function() { - return expect(this.model.get("uploading")).toBeFalsy(); + expect(this.model.get("uploading")).toBeFalsy(); }); it("is valid by default", function() { - return expect(this.model.isValid()).toBeTruthy(); + expect(this.model.isValid()).toBeTruthy(); }); it("is valid for text files by default", function() { const file = {"type": "text/plain", "name": "filename.txt"}; this.model.set("selectedFile", file); - return expect(this.model.isValid()).toBeTruthy(); + expect(this.model.isValid()).toBeTruthy(); }); it("is valid for PNG files by default", function() { const file = {"type": "image/png", "name": "filename.png"}; this.model.set("selectedFile", file); - return expect(this.model.isValid()).toBeTruthy(); + expect(this.model.isValid()).toBeTruthy(); }); it("can accept a file type when explicitly set", function() { const file = {"type": "image/png", "name": "filename.png"}; this.model.set({"mimeTypes": ["image/png"]}); this.model.set("selectedFile", file); - return expect(this.model.isValid()).toBeTruthy(); + expect(this.model.isValid()).toBeTruthy(); }); it("can accept a file format when explicitly set", function() { const file = {"type": "", "name": "filename.png"}; this.model.set({"fileFormats": ["png"]}); this.model.set("selectedFile", file); - return expect(this.model.isValid()).toBeTruthy(); + expect(this.model.isValid()).toBeTruthy(); }); it("can accept multiple file types", function() { const file = {"type": "image/gif", "name": "filename.gif"}; this.model.set({"mimeTypes": ["image/png", "image/jpeg", "image/gif"]}); this.model.set("selectedFile", file); - return expect(this.model.isValid()).toBeTruthy(); + expect(this.model.isValid()).toBeTruthy(); }); it("can accept multiple file formats", function() { const file = {"type": "image/gif", "name": "filename.gif"}; this.model.set({"fileFormats": ["png", "jpeg", "gif"]}); this.model.set("selectedFile", file); - return expect(this.model.isValid()).toBeTruthy(); + expect(this.model.isValid()).toBeTruthy(); }); describe("fileTypes", () => it("returns a list of the uploader's file types", function() { this.model.set('mimeTypes', ['image/png', 'application/json']); this.model.set('fileFormats', ['gif', 'srt']); - return expect(this.model.fileTypes()).toEqual(['PNG', 'JSON', 'GIF', 'SRT']); + expect(this.model.fileTypes()).toEqual(['PNG', 'JSON', 'GIF', 'SRT']); }) ); - return describe("formatValidTypes", function() { + describe("formatValidTypes", function() { it("returns a map of formatted file types and extensions", function() { this.model.set('mimeTypes', ['image/png', 'image/jpeg', 'application/json']); const formatted = this.model.formatValidTypes(); - return expect(formatted).toEqual({ + expect(formatted).toEqual({ fileTypes: 'PNG, JPEG or JSON', fileExtensions: '.png, .jpeg or .json' }); }); - return it("does not format with only one mime type", function() { + it("does not format with only one mime type", function() { this.model.set('mimeTypes', ['application/pdf']); const formatted = this.model.formatValidTypes(); - return expect(formatted).toEqual({ + expect(formatted).toEqual({ fileTypes: 'PDF', fileExtensions: '.pdf' }); diff --git a/cms/static/coffee/spec/views/assets_spec.js b/cms/static/coffee/spec/views/assets_spec.js index 44a2a9d758..3b6e8bc598 100644 --- a/cms/static/coffee/spec/views/assets_spec.js +++ b/cms/static/coffee/spec/views/assets_spec.js @@ -1,8 +1,3 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ define(["jquery", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers", "squire"], function($, AjaxHelpers, Squire) { @@ -35,7 +30,7 @@ function($, AjaxHelpers, Squire) { "Mini": this.savingSpies.constructor }); - return this.injector.require(["js/models/asset", "js/collections/asset", "js/views/asset"], + this.injector.require(["js/models/asset", "js/collections/asset", "js/views/asset"], (AssetModel, AssetCollection, AssetView) => { this.model = new AssetModel({ display_name: "test asset", @@ -61,7 +56,7 @@ function($, AjaxHelpers, Squire) { afterEach(function() { this.injector.clean(); - return this.injector.remove(); + this.injector.remove(); }); describe("Basic", function() { @@ -69,10 +64,10 @@ function($, AjaxHelpers, Squire) { let requests; ({view: this.view, requests} = this.createAssetView()); this.view.render(); - return expect(this.view.$el).toContainText("test asset"); + expect(this.view.$el).toContainText("test asset"); }); - return it("should pop a delete confirmation when the delete button is clicked", function() { + it("should pop a delete confirmation when the delete button is clicked", function() { let requests; ({view: this.view, requests} = this.createAssetView()); this.view.render().$(".remove-asset-button").click(); @@ -81,11 +76,11 @@ function($, AjaxHelpers, Squire) { expect(ctorOptions.title).toMatch('Delete File Confirmation'); // hasn't actually been removed expect(this.model.destroy).not.toHaveBeenCalled(); - return expect(this.collection).toContain(this.model); + expect(this.collection).toContain(this.model); }); }); - return describe("AJAX", function() { + describe("AJAX", function() { it("should destroy itself on confirmation", function() { let requests; ({view: this.view, requests} = this.createAssetView(this)); @@ -105,7 +100,7 @@ function($, AjaxHelpers, Squire) { expect(this.confirmationSpies.show).toHaveBeenCalled(); const savingOptions = this.confirmationSpies.constructor.calls.mostRecent().args[0]; expect(savingOptions.title).toMatch("Your file has been deleted."); - return expect(this.collection.contains(this.model)).toBeFalsy(); + expect(this.collection.contains(this.model)).toBeFalsy(); }); it("should not destroy itself if server errors", function() { @@ -121,7 +116,7 @@ function($, AjaxHelpers, Squire) { // return an error response requests[0].respond(404); expect(this.confirmationSpies.constructor).not.toHaveBeenCalled(); - return expect(this.collection.contains(this.model)).toBeTruthy(); + expect(this.collection.contains(this.model)).toBeTruthy(); }); it("should lock the asset on confirmation", function() { @@ -140,10 +135,10 @@ function($, AjaxHelpers, Squire) { // return a success response requests[0].respond(204); expect(this.savingSpies.hide).toHaveBeenCalled(); - return expect(this.model.get("locked")).toBeTruthy(); + expect(this.model.get("locked")).toBeTruthy(); }); - return it("should not lock the asset if server errors", function() { + it("should not lock the asset if server errors", function() { let requests; ({view: this.view, requests} = this.createAssetView(this)); @@ -152,12 +147,12 @@ function($, AjaxHelpers, Squire) { requests[0].respond(404); // Don't call hide because that closes the notification showing the server error. expect(this.savingSpies.hide).not.toHaveBeenCalled(); - return expect(this.model.get("locked")).toBeFalsy(); + expect(this.model.get("locked")).toBeFalsy(); }); }); }); - return describe("Assets view", function() { + describe("Assets view", function() { beforeEach(function(done) { setFixtures($("