From 757ae39487efb2d16ac1a29e2e74595fe89bf6b4 Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Fri, 21 Jun 2019 14:46:09 +0100 Subject: [PATCH] Merge pull request #1899 from overleaf/spd-implicit-return-tests Decaf cleanup: Remove implicit return from 'it' and 'describe' in tests GitOrigin-RevId: f297820e6212dddc0d60697a2fe1612ef27403b6 --- .../web/test/acceptance/src/ApiClsiTests.js | 6 +- .../test/acceptance/src/AuthorizationTests.js | 10 +- .../web/test/acceptance/src/CloseSiteTests.js | 4 +- .../web/test/acceptance/src/ExportsTests.js | 4 +- .../acceptance/src/FeatureUpdaterTests.js | 18 +-- .../web/test/acceptance/src/HistoryTests.js | 4 +- .../web/test/acceptance/src/LabelsTests.js | 2 +- .../test/acceptance/src/LinkedFilesTests.js | 12 +- .../test/acceptance/src/ProjectCRUDTests.js | 2 +- .../src/ProjectDuplicateNameTests.js | 62 +++++----- .../acceptance/src/ProjectFeaturesTests.js | 8 +- .../test/acceptance/src/ProjectInviteTests.js | 26 ++-- .../src/ProjectStructureMongoLockTest.js | 6 +- .../acceptance/src/ProjectStructureTests.js | 34 ++--- services/web/test/acceptance/src/ProxyUrls.js | 2 +- .../test/acceptance/src/RedirectUrlsTests.js | 2 +- .../test/acceptance/src/RegistrationTests.js | 12 +- .../test/acceptance/src/RestoringFilesTest.js | 16 +-- .../acceptance/src/SecurityHeadersTests.js | 2 +- .../web/test/acceptance/src/SessionTests.js | 8 +- .../web/test/acceptance/src/SettingsTests.js | 2 +- .../test/acceptance/src/SubscriptionTests.js | 22 ++-- .../test/acceptance/src/TokenAccessTests.js | 32 ++--- .../test/acceptance/src/TpdsUpdateTests.js | 4 +- .../test/acceptance/src/UserEmailsTests.js | 8 +- .../test/acceptance/src/UserReconfirmTests.js | 4 +- .../src/UserThirdPartyIdentityTests.js | 14 +-- services/web/test/smoke/src/SmokeTests.js | 2 +- .../Announcement/AnnouncementsHandlerTests.js | 8 +- .../AuthenticationControllerTests.js | 84 ++++++------- .../AuthenticationManagerTests.js | 64 +++++----- .../AuthorizationManagerTests.js | 98 +++++++-------- .../AuthorizationMiddlewareTests.js | 50 ++++---- .../BetaProgram/BetaProgramControllerTests.js | 14 +-- .../BetaProgram/BetaProgramHandlerTests.js | 10 +- .../test/unit/src/Blog/BlogControllerTests.js | 4 +- .../BrandVariationsHandlerTests.js | 4 +- .../test/unit/src/Chat/ChatApiHandlerTests.js | 14 +-- .../test/unit/src/Chat/ChatControllerTests.js | 8 +- .../CollaboratorsControllerTests.js | 10 +- .../CollaboratorsHandlerTests.js | 56 ++++----- .../CollaboratorsInviteControllerTests.js | 76 ++++++------ .../CollaboratorsInviteHandlerTests.js | 78 ++++++------ .../src/Compile/ClsiCookieManagerTests.js | 10 +- .../src/Compile/ClsiFormatCheckerTests.js | 8 +- .../test/unit/src/Compile/ClsiManagerTests.js | 62 +++++----- .../unit/src/Compile/ClsiStateManagerTests.js | 28 ++--- .../src/Compile/CompileControllerTests.js | 54 ++++---- .../unit/src/Compile/CompileManagerTests.js | 20 +-- .../src/Contact/ContactControllerTests.js | 4 +- .../unit/src/Contact/ContactManagerTests.js | 14 +-- .../unit/src/Cooldown/CooldownManagerTests.js | 16 +-- .../src/Cooldown/CooldownMiddlewareTests.js | 12 +- .../unit/src/Docstore/DocstoreManagerTests.js | 50 ++++---- .../DocumentUpdaterHandlerTests.js | 88 ++++++------- .../src/Documents/DocumentControllerTests.js | 20 +-- .../unit/src/Documents/DocumentHelperTests.js | 8 +- .../ProjectDownloadsControllerTests.js | 6 +- .../Downloads/ProjectZipStreamManagerTests.js | 16 +-- .../unit/src/Editor/EditorControllerTests.js | 58 ++++----- .../src/Editor/EditorHttpControllerTests.js | 38 +++--- .../Editor/EditorRealTimeControllerTests.js | 6 +- .../test/unit/src/Email/EmailBuilderTests.js | 10 +- .../test/unit/src/Email/EmailHandlerTests.js | 6 +- .../test/unit/src/Email/EmailSenderTests.js | 6 +- .../src/Exports/ExportsControllerTests.js | 4 +- .../unit/src/Exports/ExportsHandlerTests.js | 46 +++---- .../src/History/HistoryControllerTests.js | 30 ++--- .../unit/src/History/HistoryManagerTests.js | 22 ++-- .../unit/src/History/RestoreManagerTests.js | 16 +-- .../InactiveProjectManagerTests.js | 6 +- .../src/Institutions/InstitutionsAPITests.js | 14 +-- .../InstitutionsControllerTests.js | 4 +- .../Institutions/InstitutionsFeaturesTests.js | 8 +- .../Institutions/InstitutionsGetterTests.js | 4 +- .../Institutions/InstitutionsManagerTests.js | 4 +- .../unit/src/Metadata/MetaControllerTests.js | 10 +- .../unit/src/Metadata/MetaHandlerTests.js | 10 +- .../NotificationsBuilderTests.js | 2 +- .../NotificationsControllerTests.js | 2 +- .../NotificationsHandlerTests.js | 12 +- .../PasswordResetControllerTests.js | 16 +-- .../PasswordResetHandlerTests.js | 24 ++-- .../src/Project/DocLinesComparitorTests.js | 2 +- .../src/Project/ProjectApiControllerTests.js | 4 +- .../Project/ProjectCollabratecDetailsTest.js | 58 ++++----- .../src/Project/ProjectControllerTests.js | 26 ++-- .../Project/ProjectCreationHandlerTests.js | 20 +-- .../unit/src/Project/ProjectDeleterTests.js | 14 +-- .../src/Project/ProjectDetailsHandlerTests.js | 28 ++--- .../src/Project/ProjectDuplicatorTests.js | 6 +- .../src/Project/ProjectEditorHandlerTests.js | 14 +-- .../src/Project/ProjectEntityHandlerTests.js | 18 +-- .../ProjectEntityMongoUpdateHandlerTests.js | 34 ++--- .../ProjectEntityUpdateHandlerTests.js | 116 +++++++++--------- .../unit/src/Project/ProjectGetterTests.js | 48 ++++---- .../unit/src/Project/ProjectHelperTests.js | 4 +- .../src/Project/ProjectHistoryHandlerTests.js | 8 +- .../unit/src/Project/ProjectLocatorTests.js | 24 ++-- .../src/Project/ProjectOptionsHandlerTests.js | 10 +- .../src/Project/ProjectRootDocManagerTests.js | 54 ++++---- .../src/Project/ProjectUpdateHandlerTests.js | 4 +- .../test/unit/src/Project/SafePathTests.js | 10 +- .../src/Publishers/PublishersGetterTests.js | 2 +- .../unit/src/Referal/ReferalAllocatorTests.js | 10 +- .../unit/src/Referal/ReferalConnectTests.js | 2 +- .../unit/src/Referal/ReferalFeaturesTests.js | 6 +- .../unit/src/Referal/ReferalHandlerTests.js | 4 +- .../References/ReferencesControllerTests.js | 22 ++-- .../src/References/ReferencesHandlerTests.js | 36 +++--- .../src/Security/LoginRateLimiterTests.js | 12 +- .../src/Security/OneTimeTokenHandlerTests.js | 14 +-- .../Security/RateLimiterMiddlewareTests.js | 12 +- .../src/Subscription/FeaturesUpdaterTests.js | 4 +- .../Subscription/LimitationsManagerTests.js | 44 +++---- .../src/Subscription/RecurlyWrapperTests.js | 92 +++++++------- .../SubscriptionControllerTests.js | 36 +++--- .../SubscriptionGroupControllerTests.js | 2 +- .../SubscriptionGroupHandlerTests.js | 10 +- .../Subscription/SubscriptionHandlerTests.js | 36 +++--- .../Subscription/SubscriptionLocatorTests.js | 4 +- .../Subscription/UserFeaturesUpdaterTests.js | 2 +- .../V1SusbcriptionManagerTests.js | 32 ++--- .../src/SudoMode/SudoModeControllerTests.js | 24 ++-- .../unit/src/SudoMode/SudoModeHandlerTests.js | 28 ++--- .../src/SudoMode/SudoModeMiddlewareTests.js | 12 +- .../SystemMessageManagerTests.js | 10 +- .../test/unit/src/Tags/TagsControllerTests.js | 16 +-- .../test/unit/src/Tags/TagsHandlerTests.js | 44 +++---- .../src/Templates/TemplatesControllerTests.js | 8 +- .../src/Templates/TemplatesManagerTests.js | 8 +- .../TpdsControllerTests.js | 10 +- .../TpdsUpdateHandlerTests.js | 6 +- .../TpdsUpdateSenderTests.js | 6 +- .../ThirdPartyDataStore/UpdateMergerTests.js | 20 +-- .../TokenAccess/TokenAccessControllerTests.js | 108 ++++++++-------- .../TokenAccess/TokenAccessHandlerTests.js | 82 ++++++------- .../unit/src/Uploads/ArchiveManagerTests.js | 36 +++--- .../Uploads/FileSystemImportManagerTests.js | 36 +++--- .../unit/src/Uploads/FileTypeManagerTests.js | 10 +- .../Uploads/ProjectUploadControllerTests.js | 18 +-- .../src/Uploads/ProjectUploadManagerTests.js | 12 +- .../test/unit/src/User/UserControllerTests.js | 28 ++--- .../test/unit/src/User/UserCreatorTests.js | 4 +- .../test/unit/src/User/UserDeleterTests.js | 10 +- .../UserEmailsConfirmationHandlerTests.js | 22 ++-- .../src/User/UserEmailsControllerTests.js | 20 +-- .../web/test/unit/src/User/UserGetterTests.js | 12 +- .../test/unit/src/User/UserHandlerTests.js | 4 +- .../unit/src/User/UserInfoControllerTests.js | 16 +-- .../unit/src/User/UserPagesControllerTests.js | 20 +-- .../src/User/UserRegistrationHandlerTests.js | 22 ++-- .../unit/src/User/UserSessionsManagerTests.js | 50 ++++---- .../test/unit/src/User/UserUpdaterTests.js | 12 +- .../UserMembershipAuthorizationTests.js | 6 +- .../UserMembershipControllerTests.js | 14 +-- .../UserMembershipHandlerTests.js | 16 +-- .../UserMembershipViewModelTests.js | 6 +- .../UserMembershipsHandlerTests.js | 2 +- .../test/unit/src/infrastructure/CsrfTests.js | 12 +- .../src/infrastructure/GeoIpLookupTests.js | 6 +- .../LockManager/ReleasingTheLock.js | 2 +- .../LockManager/getLockTests.js | 10 +- .../LockManager/tryLockTests.js | 6 +- .../src/infrastructure/ProxyManagerTests.js | 6 +- .../src/infrastructure/RateLimterTests.js | 8 +- .../src/infrastructure/RedisWrapperTests.js | 4 +- .../spell-check/SpellCheckManagerTests.js | 2 +- .../history/util/displayNameForUserTests.js | 2 +- .../src/utils/EventEmitterTests.js | 2 +- 170 files changed, 1691 insertions(+), 1691 deletions(-) diff --git a/services/web/test/acceptance/src/ApiClsiTests.js b/services/web/test/acceptance/src/ApiClsiTests.js index ef01ab4f83..8e5c72a189 100644 --- a/services/web/test/acceptance/src/ApiClsiTests.js +++ b/services/web/test/acceptance/src/ApiClsiTests.js @@ -84,7 +84,7 @@ describe('ApiClsiTests', function() { ) })) - return describe('unauthorized', () => + describe('unauthorized', () => it('returns 401', function(done) { return request.post( { @@ -103,7 +103,7 @@ describe('ApiClsiTests', function() { })) }) - return describe('get output', function() { + describe('get output', function() { describe('valid file', () => it('returns the file', done => authed_request.get( @@ -132,7 +132,7 @@ describe('ApiClsiTests', function() { } ))) - return describe('unauthorized', () => + describe('unauthorized', () => it('returns 401', done => request.get( '/api/clsi/compile/abcd/build/1234/output/project.pdf', diff --git a/services/web/test/acceptance/src/AuthorizationTests.js b/services/web/test/acceptance/src/AuthorizationTests.js index 2f3836e24f..f3672a6c8c 100644 --- a/services/web/test/acceptance/src/AuthorizationTests.js +++ b/services/web/test/acceptance/src/AuthorizationTests.js @@ -393,7 +393,7 @@ describe('Authorization', function() { ) }) - return it('should allow site admin users admin access to it', function(done) { + it('should allow site admin users admin access to it', function(done) { return expect_admin_access(this.site_admin, this.project_id, done) }) }) @@ -472,7 +472,7 @@ describe('Authorization', function() { return expect_settings_write_access(this.rw_user, this.project_id, done) }) - return it('should not allow the read-write user admin access to it', function(done) { + it('should not allow the read-write user admin access to it', function(done) { return expect_no_admin_access( this.rw_user, this.project_id, @@ -539,7 +539,7 @@ describe('Authorization', function() { ) }) - return it('should not allow an anonymous user admin access to it', function(done) { + it('should not allow an anonymous user admin access to it', function(done) { return expect_no_admin_access( this.anon, this.project_id, @@ -549,7 +549,7 @@ describe('Authorization', function() { }) }) - return describe('public read-only project', function() { + describe('public read-only project', function() { before(function(done) { return this.owner.createProject( 'public-ro-project', @@ -606,7 +606,7 @@ describe('Authorization', function() { ) }) - return it('should not allow an anonymous user admin access to it', function(done) { + it('should not allow an anonymous user admin access to it', function(done) { return expect_no_admin_access( this.anon, this.project_id, diff --git a/services/web/test/acceptance/src/CloseSiteTests.js b/services/web/test/acceptance/src/CloseSiteTests.js index 0a6e260f5a..e33d45929a 100644 --- a/services/web/test/acceptance/src/CloseSiteTests.js +++ b/services/web/test/acceptance/src/CloseSiteTests.js @@ -22,12 +22,12 @@ describe('siteIsOpen', function() { return done() }))) - return describe('when siteIsOpen is false', function() { + describe('when siteIsOpen is false', function() { beforeEach(() => (Settings.siteIsOpen = false)) afterEach(() => (Settings.siteIsOpen = true)) - return it('should return maintenance page', done => + it('should return maintenance page', done => request.get('/login', function(error, response) { response.statusCode.should.equal(503) return done() diff --git a/services/web/test/acceptance/src/ExportsTests.js b/services/web/test/acceptance/src/ExportsTests.js index a6d438d7ea..47fa3b1968 100644 --- a/services/web/test/acceptance/src/ExportsTests.js +++ b/services/web/test/acceptance/src/ExportsTests.js @@ -44,7 +44,7 @@ describe('Exports', function() { }) }) - return describe('exporting a project', function() { + describe('exporting a project', function() { beforeEach(function(done) { this.version = Math.floor(Math.random() * 10000) MockProjectHistoryApi.setProjectVersion(this.project_id, this.version) @@ -101,7 +101,7 @@ describe('Exports', function() { return done() }) - return it('should have returned the export ID provided by v1', function(done) { + it('should have returned the export ID provided by v1', function(done) { expect(this.exportResponseBody.export_v1_id).to.equal(this.export_id) return done() }) diff --git a/services/web/test/acceptance/src/FeatureUpdaterTests.js b/services/web/test/acceptance/src/FeatureUpdaterTests.js index 50c678da52..5b4fd24380 100644 --- a/services/web/test/acceptance/src/FeatureUpdaterTests.js +++ b/services/web/test/acceptance/src/FeatureUpdaterTests.js @@ -77,7 +77,7 @@ describe('FeatureUpdater.refreshFeatures', function() { }) }) // returns a promise - return it('should set their features to the upgraded set', function(done) { + it('should set their features to the upgraded set', function(done) { return syncUserAndGetFeatures(this.user, (error, features) => { if (error != null) { throw error @@ -102,7 +102,7 @@ describe('FeatureUpdater.refreshFeatures', function() { }) }) // returns a promise - return it('should set their features to the upgraded set', function(done) { + it('should set their features to the upgraded set', function(done) { return syncUserAndGetFeatures(this.user, (error, features) => { if (error != null) { throw error @@ -128,7 +128,7 @@ describe('FeatureUpdater.refreshFeatures', function() { ) }) // returns a promise - return it('should set their features to the bonus set', function(done) { + it('should set their features to the bonus set', function(done) { return syncUserAndGetFeatures(this.user, (error, features) => { if (error != null) { throw error @@ -175,7 +175,7 @@ describe('FeatureUpdater.refreshFeatures', function() { }) }) - return it('should not set their features if institution is not confirmed', function(done) { + it('should not set their features if institution is not confirmed', function(done) { this.affiliationData.institution.confirmed = false MockV1Api.setAffiliations([this.affiliationData]) return this.user.confirmEmail(this.email, error => { @@ -200,7 +200,7 @@ describe('FeatureUpdater.refreshFeatures', function() { ) }) // returns a promise - return it('should set their features to the bonus set and downgrade the extras', function(done) { + it('should set their features to the bonus set and downgrade the extras', function(done) { return syncUserAndGetFeatures(this.user, (error, features) => { if (error != null) { throw error @@ -232,7 +232,7 @@ describe('FeatureUpdater.refreshFeatures', function() { ) }) // returns a promise - return it('should set their features to the v1 plan', function(done) { + it('should set their features to the v1 plan', function(done) { return syncUserAndGetFeatures(this.user, (error, features) => { if (error != null) { throw error @@ -260,7 +260,7 @@ describe('FeatureUpdater.refreshFeatures', function() { ) }) // returns a promise - return it('should set their features to the best of the v1 plan and bonus features', function(done) { + it('should set their features to the best of the v1 plan and bonus features', function(done) { return syncUserAndGetFeatures(this.user, (error, features) => { if (error != null) { throw error @@ -304,7 +304,7 @@ describe('FeatureUpdater.refreshFeatures', function() { ) }) - return it('should set their features to the best set', function(done) { + it('should set their features to the best set', function(done) { return syncUserAndGetFeatures(this.user, (error, features) => { if (error != null) { throw error @@ -318,7 +318,7 @@ describe('FeatureUpdater.refreshFeatures', function() { }) }) - return describe('when the notifyV1Flag is passed', function() { + describe('when the notifyV1Flag is passed', function() { beforeEach(function() { return User.update( { diff --git a/services/web/test/acceptance/src/HistoryTests.js b/services/web/test/acceptance/src/HistoryTests.js index 7bffe4cd89..b636229dfc 100644 --- a/services/web/test/acceptance/src/HistoryTests.js +++ b/services/web/test/acceptance/src/HistoryTests.js @@ -23,7 +23,7 @@ describe('History', function() { return this.owner.login(done) }) - return describe('zip download of version', function() { + describe('zip download of version', function() { it('should stream the zip file of a version', function(done) { return this.owner.createProject( 'example-project', @@ -71,7 +71,7 @@ describe('History', function() { ) }) - return it('should return 402 for non-v2-history project', function(done) { + it('should return 402 for non-v2-history project', function(done) { return this.owner.createProject('non-v2-project', (error, project_id) => { this.project_id = project_id if (error != null) { diff --git a/services/web/test/acceptance/src/LabelsTests.js b/services/web/test/acceptance/src/LabelsTests.js index 5a7bc7efbf..57da628d62 100644 --- a/services/web/test/acceptance/src/LabelsTests.js +++ b/services/web/test/acceptance/src/LabelsTests.js @@ -93,7 +93,7 @@ describe('Labels', function() { ) }) - return it('deleting a label', function(done) { + it('deleting a label', function(done) { const label_id = new ObjectId().toString() const comment = 'a label comment' const version = 3 diff --git a/services/web/test/acceptance/src/LinkedFilesTests.js b/services/web/test/acceptance/src/LinkedFilesTests.js index 82ec927f47..1be5bc396a 100644 --- a/services/web/test/acceptance/src/LinkedFilesTests.js +++ b/services/web/test/acceptance/src/LinkedFilesTests.js @@ -236,7 +236,7 @@ describe('LinkedFiles', function() { ) }) - return it('should not allow to create a linked-file with v1 id', function(done) { + it('should not allow to create a linked-file with v1 id', function(done) { return this.owner.request.post( { url: `/project/${this.project_one_id}/linked_file`, @@ -299,7 +299,7 @@ describe('LinkedFiles', function() { ) }) - return it('should refuse to refresh', function(done) { + it('should refuse to refresh', function(done) { return this.owner.request.post( { url: `/project/${this.project_one_id}/linked_file/abcd/refresh`, @@ -524,7 +524,7 @@ describe('LinkedFiles', function() { ) }) - return it('should accept a URL withuot a leading http://, and add it', function(done) { + it('should accept a URL withuot a leading http://, and add it', function(done) { return this.owner.request.post( { url: `/project/${this.project_id}/linked_file`, @@ -664,7 +664,7 @@ describe('LinkedFiles', function() { ) }) - return it('should refresh the file', function(done) { + it('should refresh the file', function(done) { return this.owner.request.post( { url: `/project/${this.project_one_id}/linked_file/${ @@ -694,7 +694,7 @@ describe('LinkedFiles', function() { }) }) - return describe('with a linked project_output_file from a v1 project that has not been imported', function() { + describe('with a linked project_output_file from a v1 project that has not been imported', function() { before(function(done) { return async.series( [ @@ -734,7 +734,7 @@ describe('LinkedFiles', function() { ) }) - return it('should refuse to refresh', function(done) { + it('should refuse to refresh', function(done) { return this.owner.request.post( { url: `/project/${this.project_one_id}/linked_file/abcdef/refresh`, diff --git a/services/web/test/acceptance/src/ProjectCRUDTests.js b/services/web/test/acceptance/src/ProjectCRUDTests.js index 048d3de052..2e56a59009 100644 --- a/services/web/test/acceptance/src/ProjectCRUDTests.js +++ b/services/web/test/acceptance/src/ProjectCRUDTests.js @@ -31,7 +31,7 @@ describe('Project CRUD', function() { ) })) - return describe('when project has malformed id', () => + describe('when project has malformed id', () => it('should return 404', function(done) { return this.user.request.get('/project/blah', function(err, res, body) { expect(res.statusCode).to.equal(404) diff --git a/services/web/test/acceptance/src/ProjectDuplicateNameTests.js b/services/web/test/acceptance/src/ProjectDuplicateNameTests.js index da3989cb16..b58f264942 100644 --- a/services/web/test/acceptance/src/ProjectDuplicateNameTests.js +++ b/services/web/test/acceptance/src/ProjectDuplicateNameTests.js @@ -40,7 +40,7 @@ describe('ProjectDuplicateNames', function() { return (this.callback = sinon.stub()) }) - return describe('creating a project from the example template', function() { + describe('creating a project from the example template', function() { before(function(done) { return this.owner.createProject( 'example-project', @@ -117,7 +117,7 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) @@ -139,12 +139,12 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) - return describe('trying to add a folder with the same name', function() { + describe('trying to add a folder with the same name', function() { before(function(done) { return this.owner.request.post( { @@ -161,7 +161,7 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) @@ -185,7 +185,7 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) @@ -207,12 +207,12 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) - return describe('trying to upload a file with the same name', function() { + describe('trying to upload a file with the same name', function() { before(function(done) { return this.owner.request.post( { @@ -243,7 +243,7 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should succeed (overwriting the file)', function() { + it('should succeed (overwriting the file)', function() { return expect(this.body.success).to.equal(true) }) }) @@ -268,7 +268,7 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) @@ -290,12 +290,12 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) - return describe('trying to upload a file with the same name', function() { + describe('trying to upload a file with the same name', function() { before(function(done) { return this.owner.request.post( { @@ -324,7 +324,7 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with failure status', function() { + it('should respond with failure status', function() { return expect(this.body.success).to.equal(false) }) }) @@ -349,7 +349,7 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) @@ -372,12 +372,12 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) - return describe('trying to rename a file to the same name', function() { + describe('trying to rename a file to the same name', function() { before(function(done) { return this.owner.request.post( { @@ -395,7 +395,7 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with failure status', function() { + it('should respond with failure status', function() { return expect(this.res.statusCode).to.equal(400) }) }) @@ -420,7 +420,7 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) @@ -443,12 +443,12 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) - return describe('trying to rename a file to the same name', function() { + describe('trying to rename a file to the same name', function() { before(function(done) { return this.owner.request.post( { @@ -466,7 +466,7 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with failure status', function() { + it('should respond with failure status', function() { return expect(this.res.statusCode).to.equal(400) }) }) @@ -491,7 +491,7 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) @@ -514,12 +514,12 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) - return describe('trying to rename a file to the same name', function() { + describe('trying to rename a file to the same name', function() { before(function(done) { return this.owner.request.post( { @@ -537,13 +537,13 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with failure status', function() { + it('should respond with failure status', function() { return expect(this.res.statusCode).to.equal(400) }) }) }) - return describe('for an existing folder with a file with the same name', function() { + describe('for an existing folder with a file with the same name', function() { before(function(done) { return this.owner.request.post( { @@ -612,7 +612,7 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) @@ -635,7 +635,7 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) @@ -658,12 +658,12 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) - return describe('trying to move a folder into a subfolder of itself', function() { + describe('trying to move a folder into a subfolder of itself', function() { before(function(done) { return this.owner.request.post( { @@ -681,7 +681,7 @@ describe('ProjectDuplicateNames', function() { ) }) - return it('should respond with 400 error status', function() { + it('should respond with 400 error status', function() { return expect(this.res.statusCode).to.equal(400) }) }) diff --git a/services/web/test/acceptance/src/ProjectFeaturesTests.js b/services/web/test/acceptance/src/ProjectFeaturesTests.js index 8f8d7cb97e..46ced56409 100644 --- a/services/web/test/acceptance/src/ProjectFeaturesTests.js +++ b/services/web/test/acceptance/src/ProjectFeaturesTests.js @@ -40,7 +40,7 @@ describe('ProjectFeatures', function() { return async.series([cb => this.owner.login(cb)], done) }) - return describe('with private project', function() { + describe('with private project', function() { before(function(done) { return this.owner.createProject( 'private-project', @@ -62,7 +62,7 @@ describe('ProjectFeatures', function() { return this.owner.defaultFeatures(done) }) - return it('should have premium features', function(done) { + it('should have premium features', function(done) { return joinProject(this.owner._id, this.project_id, function( error, response, @@ -77,7 +77,7 @@ describe('ProjectFeatures', function() { }) }) - return describe('with an basic account', function() { + describe('with an basic account', function() { before(function(done) { return this.owner.downgradeFeatures(done) }) @@ -85,7 +85,7 @@ describe('ProjectFeatures', function() { return this.owner.defaultFeatures(done) }) - return it('should have basic features', function(done) { + it('should have basic features', function(done) { return joinProject(this.owner._id, this.project_id, function( error, response, diff --git a/services/web/test/acceptance/src/ProjectInviteTests.js b/services/web/test/acceptance/src/ProjectInviteTests.js index 5b05c374ba..2d1349d135 100644 --- a/services/web/test/acceptance/src/ProjectInviteTests.js +++ b/services/web/test/acceptance/src/ProjectInviteTests.js @@ -414,7 +414,7 @@ describe('ProjectInviteTests', function() { return done() }) - return describe('creating two invites', function() { + describe('creating two invites', function() { beforeEach(function(done) { return Async.series( [ @@ -524,7 +524,7 @@ describe('ProjectInviteTests', function() { ) }) - return it('should allow the project owner to create many invites at once', function(done) { + it('should allow the project owner to create many invites at once', function(done) { this.inviteOne = null this.inviteTwo = null return Async.series( @@ -600,7 +600,7 @@ describe('ProjectInviteTests', function() { }) }) - return describe('clicking the invite link', function() { + describe('clicking the invite link', function() { beforeEach(function(done) { this.projectId = null this.fakeProject = null @@ -667,7 +667,7 @@ describe('ProjectInviteTests', function() { ) }) - return describe('when user clicks on the invite a second time', function() { + describe('when user clicks on the invite a second time', function() { it('should just redirect to the project page', function(done) { return Async.series( [ @@ -685,7 +685,7 @@ describe('ProjectInviteTests', function() { ) }) - return describe('when the user recieves another invite to the same project', () => + describe('when the user recieves another invite to the same project', () => it('should redirect to the project page', function(done) { return Async.series( [ @@ -730,7 +730,7 @@ describe('ProjectInviteTests', function() { }) }) - return describe('user is not a member of the project', function() { + describe('user is not a member of the project', function() { it('should not grant access if the user does not accept the invite', function(done) { return Async.series( [ @@ -758,7 +758,7 @@ describe('ProjectInviteTests', function() { ) }) - return it('should allow the user to accept the invite and access the project', function(done) { + it('should allow the user to accept the invite and access the project', function(done) { return Async.series( [ cb => expectInvitePage(this.user, this.link, cb), @@ -771,7 +771,7 @@ describe('ProjectInviteTests', function() { }) }) - return describe('user is not logged in initially', function() { + describe('user is not logged in initially', function() { before(function(done) { return this.user.logout(done) }) @@ -823,7 +823,7 @@ describe('ProjectInviteTests', function() { ) }) - return it('should allow user to accept the invite if the user registers a new account', function(done) { + it('should allow user to accept the invite if the user registers a new account', function(done) { return Async.series( [ cb => expectInviteRedirectToRegister(this.user, this.link, cb), @@ -858,7 +858,7 @@ describe('ProjectInviteTests', function() { ) }) - return it('should display invalid-invite if the user registers a new account', function(done) { + it('should display invalid-invite if the user registers a new account', function(done) { const badLink = this.link.replace( this.invite.token, 'not_a_real_token' @@ -909,7 +909,7 @@ describe('ProjectInviteTests', function() { ) }) - return it('should allow user to accept the invite if the user registers a new account', function(done) { + it('should allow user to accept the invite if the user registers a new account', function(done) { return Async.series( [ cb => expectInvitePage(this.user, this.link, cb), @@ -921,7 +921,7 @@ describe('ProjectInviteTests', function() { }) }) - return describe('login workflow with non-valid token', function() { + describe('login workflow with non-valid token', function() { before(function(done) { return this.user.logout(done) }) @@ -936,7 +936,7 @@ describe('ProjectInviteTests', function() { ) }) - return it('should show the invalid-invite page once the user has logged in', function(done) { + it('should show the invalid-invite page once the user has logged in', function(done) { const badLink = this.link.replace( this.invite.token, 'not_a_real_token' diff --git a/services/web/test/acceptance/src/ProjectStructureMongoLockTest.js b/services/web/test/acceptance/src/ProjectStructureMongoLockTest.js index cbe1b3c204..cd677f0db6 100644 --- a/services/web/test/acceptance/src/ProjectStructureMongoLockTest.js +++ b/services/web/test/acceptance/src/ProjectStructureMongoLockTest.js @@ -110,7 +110,7 @@ describe('ProjectStructureMongoLock', () => ) }) - return it('can get the project if rootFolder is not in the projection', function(done) { + it('can get the project if rootFolder is not in the projection', function(done) { return ProjectGetter.getProject( this.locked_project._id, { _id: true }, @@ -123,7 +123,7 @@ describe('ProjectStructureMongoLock', () => }) }) - return describe('interacting with other projects', function() { + describe('interacting with other projects', function() { before(function(done) { return ProjectCreationHandler.createBlankProject( this.user._id, @@ -151,7 +151,7 @@ describe('ProjectStructureMongoLock', () => ) }) - return it('can get other projects without a projection', function(done) { + it('can get other projects without a projection', function(done) { return ProjectGetter.getProject( this.unlocked_project._id, (err, project) => { diff --git a/services/web/test/acceptance/src/ProjectStructureTests.js b/services/web/test/acceptance/src/ProjectStructureTests.js index 4e122b69d1..00577443c9 100644 --- a/services/web/test/acceptance/src/ProjectStructureTests.js +++ b/services/web/test/acceptance/src/ProjectStructureTests.js @@ -75,7 +75,7 @@ describe('ProjectStructureChanges', function() { return expect(version).to.equal(3) }) - return it('should version creating a file', function() { + it('should version creating a file', function() { const { fileUpdates: updates, version @@ -129,7 +129,7 @@ describe('ProjectStructureChanges', function() { return expect(version).to.equal(3) }) - return it('should version the files created', function() { + it('should version the files created', function() { const { fileUpdates: updates, version @@ -196,7 +196,7 @@ describe('ProjectStructureChanges', function() { return expect(version).to.equal(this.project_0.version + 1) }) - return it('should increment the project structure version number', function() { + it('should increment the project structure version number', function() { return expect(this.project_1.version).to.equal(this.project_0.version + 1) }) }) @@ -244,7 +244,7 @@ describe('ProjectStructureChanges', function() { return expect(version).to.equal(2) }) - return it('should version the files created', function() { + it('should version the files created', function() { const { fileUpdates: updates, version @@ -288,7 +288,7 @@ describe('ProjectStructureChanges', function() { )) }) - return it('should set the project name from the zip contents', function(done) { + it('should set the project name from the zip contents', function(done) { return ProjectGetter.getProject( this.uploaded_project_id, (error, project) => { @@ -330,7 +330,7 @@ describe('ProjectStructureChanges', function() { )) }) - return it('should set the project name from the zip contents', function(done) { + it('should set the project name from the zip contents', function(done) { return ProjectGetter.getProject( this.uploaded_project_id, (error, project) => { @@ -372,7 +372,7 @@ describe('ProjectStructureChanges', function() { ) }) - return it('should not create the top-level folder', function(done) { + it('should not create the top-level folder', function(done) { return ProjectGetter.getProject(this.uploaded_project_id, function( error, project @@ -415,7 +415,7 @@ describe('ProjectStructureChanges', function() { ) }) - return it('should treat the backslash as a directory separator', function(done) { + it('should treat the backslash as a directory separator', function(done) { return ProjectGetter.getProject(this.uploaded_project_id, function( error, project @@ -495,7 +495,7 @@ describe('ProjectStructureChanges', function() { ) }) - return it('should correctly parse Greek utf8', function() { + it('should correctly parse Greek utf8', function() { const { docUpdates: updates } = MockDocUpdaterApi.getProjectStructureUpdates(this.uploaded_project_id) @@ -584,7 +584,7 @@ describe('ProjectStructureChanges', function() { )) }) - return it('should version a replacement file', function(done) { + it('should version a replacement file', function(done) { let req const image_file = fs.createReadStream( Path.resolve(__dirname + '/../files/2pixel.png') @@ -771,7 +771,7 @@ describe('ProjectStructureChanges', function() { ) }) - return it('should version moving a folder', function(done) { + it('should version moving a folder', function(done) { return this.owner.request.post( { uri: `project/${example_project_id}/folder`, @@ -949,7 +949,7 @@ describe('ProjectStructureChanges', function() { ) }) - return it('should version renaming a folder', function(done) { + it('should version renaming a folder', function(done) { return this.owner.request.post( { uri: `project/${example_project_id}/Folder/${example_folder_id_1}/rename`, @@ -1022,7 +1022,7 @@ describe('ProjectStructureChanges', function() { }) }) - return it('should version deleting a folder', function(done) { + it('should version deleting a folder', function(done) { return this.owner.request.delete( { uri: `project/${example_project_id}/Folder/${example_folder_id_2}` @@ -1282,7 +1282,7 @@ describe('ProjectStructureChanges', function() { return image_file.pipe(req) }) - return it('should version deleting a doc', function(done) { + it('should version deleting a doc', function(done) { let req return (req = this.owner.request.delete( { @@ -1333,7 +1333,7 @@ describe('ProjectStructureChanges', function() { }) }) - return describe('uploading a document', function() { + describe('uploading a document', function() { beforeEach(function(done) { MockDocUpdaterApi.clearProjectStructureUpdates() return ProjectGetter.getProject(example_project_id, (error, project) => { @@ -1346,7 +1346,7 @@ describe('ProjectStructureChanges', function() { }) }) - return describe('with an unusual character set', function() { + describe('with an unusual character set', function() { it('should correctly handle utf16-le data', function(done) { let req const document_file = fs.createReadStream( @@ -1394,7 +1394,7 @@ describe('ProjectStructureChanges', function() { )) }) - return it('should correctly handle windows1252/iso-8859-1/latin1 data', function(done) { + it('should correctly handle windows1252/iso-8859-1/latin1 data', function(done) { let req const document_file = fs.createReadStream( Path.resolve( diff --git a/services/web/test/acceptance/src/ProxyUrls.js b/services/web/test/acceptance/src/ProxyUrls.js index 5bd6470633..17d2172b7f 100644 --- a/services/web/test/acceptance/src/ProxyUrls.js +++ b/services/web/test/acceptance/src/ProxyUrls.js @@ -66,7 +66,7 @@ describe('ProxyUrls', function() { done )) - return it('handle missing baseUrl', done => + it('handle missing baseUrl', done => async.series( [cb => assertResponse('/proxy/missing/baseUrl', 500, null, cb)], done diff --git a/services/web/test/acceptance/src/RedirectUrlsTests.js b/services/web/test/acceptance/src/RedirectUrlsTests.js index b28512d218..4d9f93842d 100644 --- a/services/web/test/acceptance/src/RedirectUrlsTests.js +++ b/services/web/test/acceptance/src/RedirectUrlsTests.js @@ -86,7 +86,7 @@ describe('RedirectUrls', function() { } )) - return it('redirects to /sign_in_to_v1 with authWithV1 setting', done => + it('redirects to /sign_in_to_v1 with authWithV1 setting', done => assertRedirect( 'get', '/docs_v1?zip_uri=http%3A%2F%2Foverleaf.test%2Ffoo%3Fbar%3Dbaz%26qux%3Dthing&bar=baz', diff --git a/services/web/test/acceptance/src/RegistrationTests.js b/services/web/test/acceptance/src/RegistrationTests.js index 016a6e7c46..2f6d48c3c4 100644 --- a/services/web/test/acceptance/src/RegistrationTests.js +++ b/services/web/test/acceptance/src/RegistrationTests.js @@ -83,7 +83,7 @@ describe('LoginRateLimit', function() { return (this.badPassword = 'badpassword') }) - return it('should rate limit login attempts after 10 within two minutes', function(done) { + it('should rate limit login attempts after 10 within two minutes', function(done) { return this.user.request.get('/login', (err, res, body) => { return async.timesSeries( 15, @@ -193,7 +193,7 @@ describe('CSRF protection', function() { }) }) - return it('should fail with a stale csrf token', function(done) { + it('should fail with a stale csrf token', function(done) { return this.user.request.get('/login', (err, res, body) => { return this.user.getCsrfToken(error => { const oldCsrfToken = this.user.csrfToken @@ -225,7 +225,7 @@ describe('Register', function() { return (this.user = new User()) }) - return it('Set emails attribute', function(done) { + it('Set emails attribute', function(done) { return this.user.register((error, user) => { expect(error).to.not.exist user.email.should.equal(this.user.email) @@ -255,7 +255,7 @@ describe('Register with bonus referal id', function() { ) }) - return it('Adds a referal when an id is supplied and the referal source is "bonus"', function(done) { + it('Adds a referal when an id is supplied and the referal source is "bonus"', function(done) { return this.user1.get((error, user) => { expect(error).to.not.exist user.refered_user_count.should.eql(1) @@ -284,7 +284,7 @@ describe('LoginViaRegistration', function() { return (this.project_id = null) }) - return describe('[Security] Trying to register/login as another user', function() { + describe('[Security] Trying to register/login as another user', function() { it('should not allow sign in with secondary email', function(done) { const secondaryEmail = 'acceptance-test-secondary@example.com' return this.user1.addEmail(secondaryEmail, err => { @@ -336,7 +336,7 @@ describe('LoginViaRegistration', function() { ) }) - return it('should still ensure user2 cannot access the project', function(done) { + it('should still ensure user2 cannot access the project', function(done) { return expectNoProjectAccess(this.user2, this.project_id, done) }) }) diff --git a/services/web/test/acceptance/src/RestoringFilesTest.js b/services/web/test/acceptance/src/RestoringFilesTest.js index 4c2418e7b0..b83f3673a5 100644 --- a/services/web/test/acceptance/src/RestoringFilesTest.js +++ b/services/web/test/acceptance/src/RestoringFilesTest.js @@ -88,7 +88,7 @@ describe('RestoringFiles', function() { }) }) - return it('should have restored the doc', function(done) { + it('should have restored the doc', function(done) { return this.owner.getProject(this.project_id, (error, project) => { if (error != null) { throw error @@ -110,7 +110,7 @@ describe('RestoringFiles', function() { }) }) - return describe('restoring from v2 history', function() { + describe('restoring from v2 history', function() { describe('restoring a text file', function() { beforeEach(function(done) { MockProjectHistoryApi.addOldFile( @@ -138,7 +138,7 @@ describe('RestoringFiles', function() { ) }) - return it('should have created a doc', function(done) { + it('should have created a doc', function(done) { return this.owner.getProject(this.project_id, (error, project) => { if (error != null) { throw error @@ -185,7 +185,7 @@ describe('RestoringFiles', function() { ) }) - return it('should have created a file', function(done) { + it('should have created a file', function(done) { return this.owner.getProject(this.project_id, (error, project) => { if (error != null) { throw error @@ -242,7 +242,7 @@ describe('RestoringFiles', function() { ) }) - return it('should have created the doc in the named folder', function(done) { + it('should have created the doc in the named folder', function(done) { return this.owner.getProject(this.project_id, (error, project) => { if (error != null) { throw error @@ -286,7 +286,7 @@ describe('RestoringFiles', function() { ) }) - return it('should have created the folder and restored the doc to it', function(done) { + it('should have created the folder and restored the doc to it', function(done) { return this.owner.getProject(this.project_id, (error, project) => { if (error != null) { throw error @@ -304,7 +304,7 @@ describe('RestoringFiles', function() { }) }) - return describe('restoring to a filename that already exists', function() { + describe('restoring to a filename that already exists', function() { beforeEach(function(done) { MockProjectHistoryApi.addOldFile( this.project_id, @@ -331,7 +331,7 @@ describe('RestoringFiles', function() { ) }) - return it('should have created the doc in the root folder', function(done) { + it('should have created the doc in the root folder', function(done) { return this.owner.getProject(this.project_id, (error, project) => { if (error != null) { throw error diff --git a/services/web/test/acceptance/src/SecurityHeadersTests.js b/services/web/test/acceptance/src/SecurityHeadersTests.js index a3d7f2aaf2..22ef7a44a5 100644 --- a/services/web/test/acceptance/src/SecurityHeadersTests.js +++ b/services/web/test/acceptance/src/SecurityHeadersTests.js @@ -81,7 +81,7 @@ describe('SecurityHeaders', function() { ) }) - return it('should have cache headers on project page', function(done) { + it('should have cache headers on project page', function(done) { return async.series( [ cb => this.user.login(cb), diff --git a/services/web/test/acceptance/src/SessionTests.js b/services/web/test/acceptance/src/SessionTests.js index e26e160ddf..cd50da55f8 100644 --- a/services/web/test/acceptance/src/SessionTests.js +++ b/services/web/test/acceptance/src/SessionTests.js @@ -89,7 +89,7 @@ describe('Sessions', function() { return (this.user2.password = this.user1.password) }) - return it('should have two sessions in UserSessions set', function(done) { + it('should have two sessions in UserSessions set', function(done) { return async.series( [ next => { @@ -212,7 +212,7 @@ describe('Sessions', function() { return (this.user3.password = this.user1.password) }) - return it('should erase both sessions when password is reset', function(done) { + it('should erase both sessions when password is reset', function(done) { return async.series( [ next => { @@ -320,7 +320,7 @@ describe('Sessions', function() { }) }) - return describe('three sessions, sessions page', function() { + describe('three sessions, sessions page', function() { before(function(done) { // set up second session for this user this.user2 = new User() @@ -338,7 +338,7 @@ describe('Sessions', function() { ) }) - return it('should allow the user to erase the other two sessions', function(done) { + it('should allow the user to erase the other two sessions', function(done) { return async.series( [ next => { diff --git a/services/web/test/acceptance/src/SettingsTests.js b/services/web/test/acceptance/src/SettingsTests.js index 3df635e637..dddd1f72be 100644 --- a/services/web/test/acceptance/src/SettingsTests.js +++ b/services/web/test/acceptance/src/SettingsTests.js @@ -48,7 +48,7 @@ describe('SettingsPage', function() { }) }) - return it('update main email address', function(done) { + it('update main email address', function(done) { const newEmail = 'foo@bar.com' return this.user.updateSettings({ email: newEmail }, error => { should.not.exist(error) diff --git a/services/web/test/acceptance/src/SubscriptionTests.js b/services/web/test/acceptance/src/SubscriptionTests.js index a94340bf24..34a08e910a 100644 --- a/services/web/test/acceptance/src/SubscriptionTests.js +++ b/services/web/test/acceptance/src/SubscriptionTests.js @@ -45,7 +45,7 @@ describe('Subscriptions', function() { return expect(this.data.personalSubscription).to.equal(null) }) - return it('should return no memberGroupSubscriptions', function() { + it('should return no memberGroupSubscriptions', function() { return expect(this.data.memberGroupSubscriptions).to.deep.equal([]) }) }) @@ -135,7 +135,7 @@ describe('Subscriptions', function() { return expect(this.data.memberGroupSubscriptions).to.deep.equal([]) }) - return it('should include redeemed coupons', function(done) { + it('should include redeemed coupons', function(done) { MockRecurlyApi.redemptions['mock-account-id'] = [ { state: 'active', coupon_code: 'test-coupon-1' }, { state: 'inactive', coupon_code: 'test-coupon-2' }, @@ -209,7 +209,7 @@ describe('Subscriptions', function() { return expect(subscription.recurly).to.not.exist }) - return it('should return no memberGroupSubscriptions', function() { + it('should return no memberGroupSubscriptions', function() { return expect(this.data.memberGroupSubscriptions).to.deep.equal([]) }) }) @@ -286,7 +286,7 @@ describe('Subscriptions', function() { return expect(this.data.personalSubscription).to.equal(null) }) - return it('should return the two memberGroupSubscriptions', function() { + it('should return the two memberGroupSubscriptions', function() { expect(this.data.memberGroupSubscriptions.length).to.equal(2) expect( // Mongoose populates the admin_id with the user @@ -348,7 +348,7 @@ describe('Subscriptions', function() { return expect(this.data.personalSubscription).to.equal(null) }) - return it('should return the managedGroupSubscriptions', function() { + it('should return the managedGroupSubscriptions', function() { expect(this.data.managedGroupSubscriptions.length).to.equal(1) const subscription = this.data.managedGroupSubscriptions[0] expect( @@ -401,7 +401,7 @@ describe('Subscriptions', function() { ) }) - return it('should return the managedInstitutions', function() { + it('should return the managedInstitutions', function() { expect(this.data.managedInstitutions.length).to.equal(1) const institution = this.data.managedInstitutions[0] expect(institution.v1Id).to.equal(this.v1Id) @@ -492,14 +492,14 @@ describe('Subscriptions', function() { ) }) - return it('should return only the affilations with confirmed institutions, and confirmed emails', function() { + it('should return only the affilations with confirmed institutions, and confirmed emails', function() { return expect(this.data.confirmedMemberInstitutions).to.deep.equal([ { name: 'Stanford', licence: 'pro_plus', confirmed: true } ]) }) }) - return describe('when the user has a v1 subscription', function() { + describe('when the user has a v1 subscription', function() { before(function(done) { let v1Id MockV1Api.setUser((v1Id = MockV1Api.nextV1Id()), { @@ -543,7 +543,7 @@ describe('Subscriptions', function() { return expect(this.data.memberGroupSubscriptions).to.deep.equal([]) }) - return it('should return a v1SubscriptionStatus', function() { + it('should return a v1SubscriptionStatus', function() { return expect(this.data.v1SubscriptionStatus).to.deep.equal( this.subscription_status ) @@ -551,7 +551,7 @@ describe('Subscriptions', function() { }) }) - return describe('canceling', function() { + describe('canceling', function() { before(function(done) { let v1Id this.user = new User() @@ -580,7 +580,7 @@ describe('Subscriptions', function() { return expect(this.v1_user.canceled).to.equal(true) }) - return it('should redirect to the subscription dashboard', function() { + it('should redirect to the subscription dashboard', function() { expect(this.response.statusCode).to.equal(302) return expect(this.response.headers.location).to.equal( '/user/subscription' diff --git a/services/web/test/acceptance/src/TokenAccessTests.js b/services/web/test/acceptance/src/TokenAccessTests.js index b6089a33b1..082628e73c 100644 --- a/services/web/test/acceptance/src/TokenAccessTests.js +++ b/services/web/test/acceptance/src/TokenAccessTests.js @@ -198,7 +198,7 @@ describe('TokenAccess', function() { ) }) - return it('should not allow the user to join the project', function(done) { + it('should not allow the user to join the project', function(done) { return try_content_access( this.other1, this.project_id, @@ -269,7 +269,7 @@ describe('TokenAccess', function() { ) }) - return describe('made private again', function() { + describe('made private again', function() { before(function(done) { return this.owner.makePrivate(this.project_id, () => setTimeout(done, 1000) @@ -299,7 +299,7 @@ describe('TokenAccess', function() { ) }) - return it('should not allow the user to join the project', function(done) { + it('should not allow the user to join the project', function(done) { return try_content_access( this.other1, this.project_id, @@ -372,7 +372,7 @@ describe('TokenAccess', function() { ) }) - return describe('made private again', function() { + describe('made private again', function() { before(function(done) { return this.owner.makePrivate(this.project_id, () => setTimeout(done, 1000) @@ -402,7 +402,7 @@ describe('TokenAccess', function() { ) }) - return it('should not allow the user to join the project', function(done) { + it('should not allow the user to join the project', function(done) { return try_anon_content_access( this.anon, this.project_id, @@ -476,7 +476,7 @@ describe('TokenAccess', function() { ) }) - return describe('made private again', function() { + describe('made private again', function() { before(function(done) { return this.owner.makePrivate(this.project_id, () => setTimeout(done, 1000) @@ -506,7 +506,7 @@ describe('TokenAccess', function() { ) }) - return it('should not allow the user to join the project', function(done) { + it('should not allow the user to join the project', function(done) { return try_content_access( this.other1, this.project_id, @@ -569,7 +569,7 @@ describe('TokenAccess', function() { ) }) - return it('should not allow the user to join the project', function(done) { + it('should not allow the user to join the project', function(done) { return try_anon_content_access( this.anon, this.project_id, @@ -642,7 +642,7 @@ describe('TokenAccess', function() { ) }) - return describe('made private again', function() { + describe('made private again', function() { before(function(done) { return this.owner.makePrivate(this.project_id, () => setTimeout(done, 1000) @@ -672,7 +672,7 @@ describe('TokenAccess', function() { ) }) - return it('should not allow the user to join the project', function(done) { + it('should not allow the user to join the project', function(done) { return try_anon_content_access( this.anon, this.project_id, @@ -748,7 +748,7 @@ describe('TokenAccess', function() { ) }) - return it('should not allow other user to join the project', function(done) { + it('should not allow other user to join the project', function(done) { return try_content_access( this.other2, this.project_id, @@ -838,7 +838,7 @@ describe('TokenAccess', function() { ) }) - return it('should not allow a different user to join the project', function(done) { + it('should not allow a different user to join the project', function(done) { return try_content_access( this.other2, this.project_id, @@ -870,7 +870,7 @@ describe('TokenAccess', function() { ) }) - return it('should redirect read only token to v1', function(done) { + it('should redirect read only token to v1', function(done) { const unimportedV1Token = 'abcd' return try_read_only_token_access( this.owner, @@ -886,7 +886,7 @@ describe('TokenAccess', function() { }) }) - return describe('importing v1 project', function() { + describe('importing v1 project', function() { before(function(done) { settings.projectImportingCheckMaxCreateDelta = 3600 settings.overleaf = { host: 'http://localhost:5000' } @@ -960,10 +960,10 @@ describe('TokenAccess', function() { ) }) - return describe('when importing check not configured', function() { + describe('when importing check not configured', function() { before(() => delete settings.projectImportingCheckMaxCreateDelta) - return it('should load editor', function(done) { + it('should load editor', function(done) { return try_read_and_write_token_access( this.owner, this.tokens.readAndWrite, diff --git a/services/web/test/acceptance/src/TpdsUpdateTests.js b/services/web/test/acceptance/src/TpdsUpdateTests.js index dead7da3e2..7ef78bc184 100644 --- a/services/web/test/acceptance/src/TpdsUpdateTests.js +++ b/services/web/test/acceptance/src/TpdsUpdateTests.js @@ -37,7 +37,7 @@ describe('TpdsUpdateTests', function() { }) }) - return describe('deleting a file', function() { + describe('deleting a file', function() { before(function(done) { return request( { @@ -59,7 +59,7 @@ describe('TpdsUpdateTests', function() { ) }) - return it('should have deleted the file', function(done) { + it('should have deleted the file', function(done) { return ProjectGetter.getProject(this.project_id, function( error, project diff --git a/services/web/test/acceptance/src/UserEmailsTests.js b/services/web/test/acceptance/src/UserEmailsTests.js index ffa6cf7658..a6576c994c 100644 --- a/services/web/test/acceptance/src/UserEmailsTests.js +++ b/services/web/test/acceptance/src/UserEmailsTests.js @@ -127,7 +127,7 @@ describe('UserEmails', function() { ) }) - return it('should not allow confirmation of the email if the user has changed', function(done) { + it('should not allow confirmation of the email if the user has changed', function(done) { let token1 = null let token2 = null this.user2 = new User() @@ -472,7 +472,7 @@ describe('UserEmails', function() { ) }) - return it("should not allow reconfirmation if the email doesn't match the user", function(done) { + it("should not allow reconfirmation if the email doesn't match the user", function(done) { return async.series( [ cb => { @@ -512,7 +512,7 @@ describe('UserEmails', function() { }) }) - return describe('setting a default email', function() { + describe('setting a default email', function() { it('should update confirmed emails for users not in v1', function(done) { const token = null return async.series( @@ -736,7 +736,7 @@ describe('UserEmails', function() { ) }) - return it('should return an error if the email exists in v1', function(done) { + it('should return an error if the email exists in v1', function(done) { MockV1Api.existingEmails.push('exists-in-v1@example.com') return async.series( [ diff --git a/services/web/test/acceptance/src/UserReconfirmTests.js b/services/web/test/acceptance/src/UserReconfirmTests.js index 81c6977f35..0b86cd5d6b 100644 --- a/services/web/test/acceptance/src/UserReconfirmTests.js +++ b/services/web/test/acceptance/src/UserReconfirmTests.js @@ -38,7 +38,7 @@ describe('User Must Reconfirm', function() { }) }) - return describe('Requesting reconfirmation email', function() { + describe('Requesting reconfirmation email', function() { it('should return a success to client for existing account', function(done) { return this.user.reconfirmAccountRequest( this.user.email, @@ -50,7 +50,7 @@ describe('User Must Reconfirm', function() { ) }) - return it('should return a 404 to client for non-existent account', function(done) { + it('should return a 404 to client for non-existent account', function(done) { return this.user.reconfirmAccountRequest( 'fake@overleaf.com', (err, response) => { diff --git a/services/web/test/acceptance/src/UserThirdPartyIdentityTests.js b/services/web/test/acceptance/src/UserThirdPartyIdentityTests.js index cff22f0204..361b7ec17b 100644 --- a/services/web/test/acceptance/src/UserThirdPartyIdentityTests.js +++ b/services/web/test/acceptance/src/UserThirdPartyIdentityTests.js @@ -56,7 +56,7 @@ describe('ThirdPartyIdentityManager', function() { ) }) - return it('should merge external data', function(done) { + it('should merge external data', function(done) { this.externalData = { test: 'different', another: 'key' @@ -76,7 +76,7 @@ describe('ThirdPartyIdentityManager', function() { }) }) - return describe('when third party identity does not exists', () => + describe('when third party identity does not exists', () => it('should return error', function(done) { ThirdPartyIdentityManager.login( this.provider, @@ -105,7 +105,7 @@ describe('ThirdPartyIdentityManager', function() { ) })) - return describe('when provider is already linked', function() { + describe('when provider is already linked', function() { beforeEach(function(done) { return ThirdPartyIdentityManager.link( this.user.id, @@ -144,7 +144,7 @@ describe('ThirdPartyIdentityManager', function() { ) }) - return it('should replace existing data', function(done) { + it('should replace existing data', function(done) { this.externalData = { replace: 'data' } return ThirdPartyIdentityManager.link( this.user.id, @@ -164,7 +164,7 @@ describe('ThirdPartyIdentityManager', function() { }) }) - return describe('unlink', function() { + describe('unlink', function() { describe('when provider not already linked', () => it('should succeed', function(done) { return ThirdPartyIdentityManager.unlink( @@ -178,7 +178,7 @@ describe('ThirdPartyIdentityManager', function() { ) })) - return describe('when provider is already linked', function() { + describe('when provider is already linked', function() { beforeEach(function(done) { return ThirdPartyIdentityManager.link( this.user.id, @@ -189,7 +189,7 @@ describe('ThirdPartyIdentityManager', function() { ) }) - return it('should remove thirdPartyIdentifiers entry', function(done) { + it('should remove thirdPartyIdentifiers entry', function(done) { return ThirdPartyIdentityManager.unlink( this.user.id, this.provider, diff --git a/services/web/test/smoke/src/SmokeTests.js b/services/web/test/smoke/src/SmokeTests.js index 509c5fea37..5ce6bca2ff 100644 --- a/services/web/test/smoke/src/SmokeTests.js +++ b/services/web/test/smoke/src/SmokeTests.js @@ -198,7 +198,7 @@ curl -H "X-Forwarded-Proto: https" -v ${buildUrl( }) }) - return it('the project list', function(done) { + it('the project list', function(done) { logger.log('smoke test: Checking can load project list') this.timeout(4000) const command = `\ diff --git a/services/web/test/unit/src/Announcement/AnnouncementsHandlerTests.js b/services/web/test/unit/src/Announcement/AnnouncementsHandlerTests.js index 6b5c1bb5c6..4db144bd5a 100644 --- a/services/web/test/unit/src/Announcement/AnnouncementsHandlerTests.js +++ b/services/web/test/unit/src/Announcement/AnnouncementsHandlerTests.js @@ -43,7 +43,7 @@ describe('AnnouncementsHandler', function() { })) }) - return describe('getUnreadAnnouncements', function() { + describe('getUnreadAnnouncements', function() { beforeEach(function() { this.stubbedAnnouncements = [ { @@ -178,7 +178,7 @@ describe('AnnouncementsHandler', function() { .returns(this.stubbedDomainSpecificAnn)) }) - return it('should insert the domain specific in the correct place', function(done) { + it('should insert the domain specific in the correct place', function(done) { this.AnalyticsManager.getLastOccurrence.callsArgWith(2, null, []) return this.handler.getUnreadAnnouncements( this.user, @@ -194,7 +194,7 @@ describe('AnnouncementsHandler', function() { }) }) - return describe('_domainSpecificAnnouncements', function() { + describe('_domainSpecificAnnouncements', function() { beforeEach(function() { return (this.settings.domainAnnouncements = [ { @@ -233,7 +233,7 @@ describe('AnnouncementsHandler', function() { return done() }) - return it('should match on domain', function(done) { + it('should match on domain', function(done) { this.settings.domainAnnouncements[2].domains = ['yahoo.com'] const result = this.handler._domainSpecificAnnouncements( 'someone@gmail.com' diff --git a/services/web/test/unit/src/Authentication/AuthenticationControllerTests.js b/services/web/test/unit/src/Authentication/AuthenticationControllerTests.js index 77a208d151..66756e7958 100644 --- a/services/web/test/unit/src/Authentication/AuthenticationControllerTests.js +++ b/services/web/test/unit/src/Authentication/AuthenticationControllerTests.js @@ -108,7 +108,7 @@ describe('AuthenticationController', function() { return this.stub.restore() }) - return it('should do the right thing in all cases', function() { + it('should do the right thing in all cases', function() { this.AuthenticationController.getLoggedInUserId.returns('some_id') expect(this.AuthenticationController.isUserLoggedIn(this.req)).to.equal( true @@ -140,7 +140,7 @@ describe('AuthenticationController', function() { return (this.req.session.user = this.user) }) - return it('should update the right properties', function() { + it('should update the right properties', function() { this.AuthenticationController.setInSessionUser(this.req, { first_name: 'new_first_name', email: 'new_email' @@ -183,7 +183,7 @@ describe('AuthenticationController', function() { return this.passport.authenticate.callsArgWith(1, this.err) }) - return it('should return next with an error', function() { + it('should return next with an error', function() { this.AuthenticationController.passportLogin( this.req, this.res, @@ -208,7 +208,7 @@ describe('AuthenticationController', function() { return delete this.req.session.postLoginRedirect }) - return it('should call finishLogin', function() { + it('should call finishLogin', function() { this.AuthenticationController.passportLogin( this.req, this.res, @@ -221,7 +221,7 @@ describe('AuthenticationController', function() { }) }) - return describe('when authenticate does not produce a user', function() { + describe('when authenticate does not produce a user', function() { beforeEach(function() { this.info = { text: 'a', type: 'b' } return this.passport.authenticate.callsArgWith( @@ -243,7 +243,7 @@ describe('AuthenticationController', function() { ) }) - return it('should not send a json response with redirect', function() { + it('should not send a json response with redirect', function() { this.AuthenticationController.passportLogin( this.req, this.res, @@ -304,7 +304,7 @@ describe('AuthenticationController', function() { }) }) - return describe('when req.session.save produces an error', function() { + describe('when req.session.save produces an error', function() { beforeEach(function() { return (this.req.session.save = sinon .stub() @@ -319,7 +319,7 @@ describe('AuthenticationController', function() { }) }) - return it('should not call UserSessionsManager.trackSession', function(done) { + it('should not call UserSessionsManager.trackSession', function(done) { return this.call(err => { this.UserSessionsManager.trackSession.callCount.should.equal(0) return done() @@ -339,7 +339,7 @@ describe('AuthenticationController', function() { return expect(user).to.deep.equal({ _id: 'one' }) }) - return it('should work with legacy sessions', function() { + it('should work with legacy sessions', function() { this.req.session = { user: { _id: 'one' } } const user = this.AuthenticationController.getSessionUser(this.req) return expect(user).to.deep.equal({ _id: 'one' }) @@ -369,7 +369,7 @@ describe('AuthenticationController', function() { .callsArgWith(3, null, [null, { redir: '/somewhere' }, null])) }) - return it('should stop early and call done with this info object', function(done) { + it('should stop early and call done with this info object', function(done) { this.AuthenticationController.doPassportLogin( this.req, this.req.body.email, @@ -394,7 +394,7 @@ describe('AuthenticationController', function() { ) }) - return it('should block the request if the limit has been exceeded', function(done) { + it('should block the request if the limit has been exceeded', function(done) { this.AuthenticationController.doPassportLogin( this.req, this.req.body.email, @@ -429,7 +429,7 @@ describe('AuthenticationController', function() { .should.equal(true) }) - return it("should establish the user's session", function() { + it("should establish the user's session", function() { return this.cb.calledWith(null, this.user).should.equal(true) }) }) @@ -484,14 +484,14 @@ describe('AuthenticationController', function() { .should.equal(true) }) - return it('should track the login event', function() { + it('should track the login event', function() { return this.AnalyticsManager.recordEvent .calledWith(this.user._id, 'user-logged-in') .should.equal(true) }) }) - return describe('when the user is not authenticated', function() { + describe('when the user is not authenticated', function() { beforeEach(function() { this.LoginRateLimiter.processLoginRequest.callsArgWith(1, null, true) this.AuthenticationManager.authenticate = sinon @@ -529,7 +529,7 @@ describe('AuthenticationController', function() { ) }) - return it('should log the failed login', function() { + it('should log the failed login', function() { return this.logger.log .calledWith({ email: this.email.toLowerCase() }, 'failed log in') .should.equal(true) @@ -573,7 +573,7 @@ describe('AuthenticationController', function() { return expect(result).to.equal(null) }) - return it('should return null if there is no req', function() { + it('should return null if there is no req', function() { this.req = {} const result = this.AuthenticationController.getLoggedInUserId(this.req) return expect(result).to.equal(null) @@ -600,12 +600,12 @@ describe('AuthenticationController', function() { return this.middleware(this.req, this.res, this.next) }) - return it('should call the next method in the chain', function() { + it('should call the next method in the chain', function() { return this.next.called.should.equal(true) }) }) - return describe('when the user is not logged in', function() { + describe('when the user is not logged in', function() { beforeEach(function() { this.req.session = {} this.AuthenticationController._redirectToLoginOrRegisterPage = sinon.stub() @@ -613,7 +613,7 @@ describe('AuthenticationController', function() { return this.middleware(this.req, this.res, this.next) }) - return it('should redirect to the register or login page', function() { + it('should redirect to the register or login page', function() { return this.AuthenticationController._redirectToLoginOrRegisterPage .calledWith(this.req, this.res) .should.equal(true) @@ -697,7 +697,7 @@ describe('AuthenticationController', function() { ) }) - return it('should call next() directly', function() { + it('should call next() directly', function() { return this.next.called.should.equal(true) }) }) @@ -714,7 +714,7 @@ describe('AuthenticationController', function() { ) }) - return it('should call next() directly', function() { + it('should call next() directly', function() { return this.next.called.should.equal(true) }) }) @@ -729,7 +729,7 @@ describe('AuthenticationController', function() { ) }) - return it('should pass the request onto httpAuth', function() { + it('should pass the request onto httpAuth', function() { return this.AuthenticationController.httpAuth .calledWith(this.req, this.res, this.next) .should.equal(true) @@ -746,12 +746,12 @@ describe('AuthenticationController', function() { ) }) - return it('should call next() directly', function() { + it('should call next() directly', function() { return this.next.called.should.equal(true) }) }) - return describe('with no login credentials', function() { + describe('with no login credentials', function() { beforeEach(function() { this.req.session = {} return this.AuthenticationController.requireGlobalLogin( @@ -765,7 +765,7 @@ describe('AuthenticationController', function() { return this.setRedirect.callCount.should.equal(1) }) - return it('should redirect to the /login page', function() { + it('should redirect to the /login page', function() { return this.res.redirectedTo.should.equal('/login') }) }) @@ -788,7 +788,7 @@ describe('AuthenticationController', function() { return this.middleware(this.req, this.res, this.next) }) - return it('should redirect to the login page', function() { + it('should redirect to the login page', function() { this.AuthenticationController._redirectToRegisterPage .calledWith(this.req, this.res) .should.equal(false) @@ -804,7 +804,7 @@ describe('AuthenticationController', function() { return this.middleware(this.req, this.res, this.next) }) - return it('should redirect to the register page', function() { + it('should redirect to the register page', function() { this.AuthenticationController._redirectToRegisterPage .calledWith(this.req, this.res) .should.equal(true) @@ -814,13 +814,13 @@ describe('AuthenticationController', function() { }) }) - return describe('they have been invited to a project', function() { + describe('they have been invited to a project', function() { beforeEach(function() { this.req.query.project_name = 'something' return this.middleware(this.req, this.res, this.next) }) - return it('should redirect to the register page', function() { + it('should redirect to the register page', function() { this.AuthenticationController._redirectToRegisterPage .calledWith(this.req, this.res) .should.equal(true) @@ -848,7 +848,7 @@ describe('AuthenticationController', function() { return this.res.redirectedTo.should.equal('/register?extra_query=foo') }) - return it('should log out a message', function() { + it('should log out a message', function() { return this.logger.log .calledWith( { url: this.url }, @@ -868,7 +868,7 @@ describe('AuthenticationController', function() { ) }) - return it('should redirect to the register page with a query string attached', function() { + it('should redirect to the register page with a query string attached', function() { this.req.session.postLoginRedirect.should.equal( '/target/url?extra_query=foo' ) @@ -900,7 +900,7 @@ describe('AuthenticationController', function() { ].should.equal(1) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -914,7 +914,7 @@ describe('AuthenticationController', function() { return this.Metrics.inc.calledWith('user.login.failed').should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -956,7 +956,7 @@ describe('AuthenticationController', function() { return (this.req = { session: {} }) }) - return it('should not set the redirect', function() { + it('should not set the redirect', function() { this.AuthenticationController.setRedirectInSession( this.req, '/something.png' @@ -965,12 +965,12 @@ describe('AuthenticationController', function() { }) }) - return describe('with a js path', function() { + describe('with a js path', function() { beforeEach(function() { return (this.req = { session: {} }) }) - return it('should not set the redirect', function() { + it('should not set the redirect', function() { this.AuthenticationController.setRedirectInSession( this.req, '/js/something.js' @@ -995,7 +995,7 @@ describe('AuthenticationController', function() { ).to.be.null }) - return it('handle null values', function() { + it('handle null values', function() { this.req = { session: {} } return expect( this.AuthenticationController._getRedirectFromSession(this.req) @@ -1033,13 +1033,13 @@ describe('AuthenticationController', function() { return (this.req = { session: { postLoginRedirect: '/a?b=c' } }) }) - return it('should remove the redirect property from session', function() { + it('should remove the redirect property from session', function() { this.AuthenticationController._clearRedirectFromSession(this.req) return expect(this.req.session.postLoginRedirect).to.equal(undefined) }) }) - return describe('finishLogin', function() { + describe('finishLogin', function() { // - get redirect // - async handlers // - afterLoginSessionSetup @@ -1151,7 +1151,7 @@ describe('AuthenticationController', function() { return (this.res.redirect = sinon.stub()) }) - return it('should issue a plain redirect', function() { + it('should issue a plain redirect', function() { this.AuthenticationController.finishLogin( this.user, this.req, @@ -1164,12 +1164,12 @@ describe('AuthenticationController', function() { }) }) - return describe('when user is flagged to reconfirm', function() { + describe('when user is flagged to reconfirm', function() { beforeEach(function() { this.req.session = {} return (this.user.must_reconfirm = true) }) - return it('should redirect to reconfirm page', function() { + it('should redirect to reconfirm page', function() { this.AuthenticationController.finishLogin( this.user, this.req, diff --git a/services/web/test/unit/src/Authentication/AuthenticationManagerTests.js b/services/web/test/unit/src/Authentication/AuthenticationManagerTests.js index 32aae33452..d508152d36 100644 --- a/services/web/test/unit/src/Authentication/AuthenticationManagerTests.js +++ b/services/web/test/unit/src/Authentication/AuthenticationManagerTests.js @@ -87,12 +87,12 @@ describe('AuthenticationManager', function() { .should.equal(true) }) - return it('should return the user', function() { + it('should return the user', function() { return this.callback.calledWith(null, this.user).should.equal(true) }) }) - return describe('when the encrypted passwords do not match', function() { + describe('when the encrypted passwords do not match', function() { beforeEach(function() { return this.AuthenticationManager.authenticate( { email: this.email }, @@ -101,13 +101,13 @@ describe('AuthenticationManager', function() { ) }) - return it('should not return the user', function() { + it('should not return the user', function() { return this.callback.calledWith(null, null).should.equal(true) }) }) }) - return describe('setUserPasswordInV2', function() { + describe('setUserPasswordInV2', function() { beforeEach(function() { this.user = { _id: '5c8791477192a80b5e76ca7e', @@ -130,7 +130,7 @@ describe('AuthenticationManager', function() { ) }) - return it('should set the hashed password', function(done) { + it('should set the hashed password', function(done) { return this.AuthenticationManager.setUserPasswordInV2( this.user._id, 'testpassword', @@ -189,7 +189,7 @@ describe('AuthenticationManager', function() { .should.equal(true) }) - return it('should return the user', function() { + it('should return the user', function() { return this.callback.calledWith(null, this.user).should.equal(true) }) }) @@ -203,7 +203,7 @@ describe('AuthenticationManager', function() { ) }) - return it('should not return the user', function() { + it('should not return the user', function() { return this.callback.calledWith(null, null).should.equal(true) }) }) @@ -248,12 +248,12 @@ describe('AuthenticationManager', function() { .should.equal(true) }) - return it('should return the user', function() { + it('should return the user', function() { return this.callback.calledWith(null, this.user).should.equal(true) }) }) - return describe('when the hashed password matches but the number of rounds is too low, but upgrades disabled', function() { + describe('when the hashed password matches but the number of rounds is too low, but upgrades disabled', function() { beforeEach(function(done) { this.settings.security.disableBcryptRoundsUpgrades = true this.user.hashedPassword = this.hashedPassword = 'asdfjadflasdf' @@ -282,13 +282,13 @@ describe('AuthenticationManager', function() { .should.equal(false) }) - return it('should return the user', function() { + it('should return the user', function() { return this.callback.calledWith(null, this.user).should.equal(true) }) }) }) - return describe('when the user does not exist in the database', function() { + describe('when the user does not exist in the database', function() { beforeEach(function() { this.User.findOne = sinon.stub().callsArgWith(1, null, null) return this.AuthenticationManager.authenticate( @@ -298,7 +298,7 @@ describe('AuthenticationManager', function() { ) }) - return it('should not return a user', function() { + it('should not return a user', function() { return this.callback.calledWith(null, null).should.equal(true) }) }) @@ -313,14 +313,14 @@ describe('AuthenticationManager', function() { return expect(result).to.equal(null) })) - return describe('invalid', function() { + describe('invalid', function() { it('should return validation error object for no email', function() { const result = this.AuthenticationManager.validateEmail('') expect(result).to.not.equal(null) return expect(result.message).to.equal('email not valid') }) - return it('should return validation error object for invalid', function() { + it('should return validation error object for invalid', function() { const result = this.AuthenticationManager.validateEmail('notanemail') expect(result).to.not.equal(null) return expect(result.message).to.equal('email not valid') @@ -359,7 +359,7 @@ describe('AuthenticationManager', function() { ).to.eql({ message: 'password is too long' }) }) - return it('should accept passwords that are a good length', function() { + it('should accept passwords that are a good length', function() { return expect( this.AuthenticationManager.validatePassword('l337h4x0r') ).to.equal(null) @@ -394,14 +394,14 @@ describe('AuthenticationManager', function() { ).to.eql({ message: 'password is too long' }) }) - return it('should accept passwords of exactly maximum length', function() { + it('should accept passwords of exactly maximum length', function() { return expect( this.AuthenticationManager.validatePassword('0123456789ab') ).to.equal(null) }) }) - return describe('when the maximum password length is set to >72 characters in settings', function() { + describe('when the maximum password length is set to >72 characters in settings', function() { beforeEach(function() { return (this.settings.passwordStrengthOptions = { length: { @@ -410,7 +410,7 @@ describe('AuthenticationManager', function() { }) }) - return it('should still reject passwords > 72 characters in length', function() { + it('should still reject passwords > 72 characters in length', function() { return expect( this.AuthenticationManager.validatePassword(this.longPassword) ).to.eql({ message: 'password is too long' }) @@ -418,7 +418,7 @@ describe('AuthenticationManager', function() { }) }) - return describe('allowed characters', function() { + describe('allowed characters', function() { describe('with the default settings for allowed characters', function() { it('should allow passwords with valid characters', function() { expect( @@ -433,7 +433,7 @@ describe('AuthenticationManager', function() { ).to.equal(null) }) - return it('should not allow passwords with invalid characters', function() { + it('should not allow passwords with invalid characters', function() { return expect( this.AuthenticationManager.validatePassword( 'correct horse battery staple' @@ -459,7 +459,7 @@ describe('AuthenticationManager', function() { ).to.equal(null) }) - return it('should disallow passwords with invalid characters', function() { + it('should disallow passwords with invalid characters', function() { return expect( this.AuthenticationManager.validatePassword( '1234567890@#$%^&*()-_=+[]{};:<>/?!£€.,' @@ -468,14 +468,14 @@ describe('AuthenticationManager', function() { }) }) - return describe('when allowAnyChars is set', function() { + describe('when allowAnyChars is set', function() { beforeEach(function() { return (this.settings.passwordStrengthOptions = { allowAnyChars: true }) }) - return it('should allow any characters', function() { + it('should allow any characters', function() { expect( this.AuthenticationManager.validatePassword( 'correct horse battery staple' @@ -491,7 +491,7 @@ describe('AuthenticationManager', function() { }) }) - return describe('setUserPassword', function() { + describe('setUserPassword', function() { beforeEach(function() { this.user_id = ObjectId() this.password = 'banana' @@ -523,7 +523,7 @@ describe('AuthenticationManager', function() { ) }) - return it('should not start the bcrypt process', function(done) { + it('should not start the bcrypt process', function(done) { return this.AuthenticationManager.setUserPassword( this.user_id, this.password, @@ -558,7 +558,7 @@ describe('AuthenticationManager', function() { ) }) - return it('should not start the bcrypt process', function(done) { + it('should not start the bcrypt process', function(done) { return this.AuthenticationManager.setUserPassword( this.user_id, this.password, @@ -571,7 +571,7 @@ describe('AuthenticationManager', function() { }) }) - return describe('password set attempt', function() { + describe('password set attempt', function() { describe('with SL user in SL', function() { beforeEach(function() { this.UserGetter.getUser = sinon @@ -612,7 +612,7 @@ describe('AuthenticationManager', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -632,7 +632,7 @@ describe('AuthenticationManager', function() { } ) }) - return it('should error', function() { + it('should error', function() { return this.callback .calledWith(new Errors.SLInV2Error('Password Reset Attempt')) .should.equal(true) @@ -653,14 +653,14 @@ describe('AuthenticationManager', function() { } ) }) - return it('should error', function() { + it('should error', function() { return this.callback .calledWith(new Errors.NotInV2Error('Password Reset Attempt')) .should.equal(true) }) }) - return describe('with v2 user in v2', function() { + describe('with v2 user in v2', function() { beforeEach(function(done) { this.settings.overleaf = true this.UserGetter.getUser = sinon @@ -676,7 +676,7 @@ describe('AuthenticationManager', function() { } ) }) - return it('should set the password in v2', function() { + it('should set the password in v2', function() { return this.callback.calledWith(null, true).should.equal(true) }) }) diff --git a/services/web/test/unit/src/Authorization/AuthorizationManagerTests.js b/services/web/test/unit/src/Authorization/AuthorizationManagerTests.js index 77d94d9d4c..8d308c72a2 100644 --- a/services/web/test/unit/src/Authorization/AuthorizationManagerTests.js +++ b/services/web/test/unit/src/Authorization/AuthorizationManagerTests.js @@ -71,7 +71,7 @@ describe('AuthorizationManager', function() { ) }) - return it("should return the user's privilege level", function() { + it("should return the user's privilege level", function() { return this.callback .calledWith(null, 'readOnly', false, false) .should.equal(true) @@ -94,7 +94,7 @@ describe('AuthorizationManager', function() { ) }) - return it('should return false', function() { + it('should return false', function() { return this.callback .calledWith(null, false, false, false) .should.equal(true) @@ -117,14 +117,14 @@ describe('AuthorizationManager', function() { ) }) - return it('should return the user as an owner', function() { + it('should return the user as an owner', function() { return this.callback .calledWith(null, 'owner', false, true) .should.equal(true) }) }) - return describe('with no user (anonymous)', function() { + describe('with no user (anonymous)', function() { describe('when the token is not valid', function() { beforeEach(function() { this.TokenAccessHandler.isValidToken = sinon @@ -157,7 +157,7 @@ describe('AuthorizationManager', function() { .should.equal(true) }) - return it('should return false', function() { + it('should return false', function() { return this.callback .calledWith(null, false, false, false) .should.equal(true) @@ -198,14 +198,14 @@ describe('AuthorizationManager', function() { .should.equal(true) }) - return it('should deny access', function() { + it('should deny access', function() { return this.callback .calledWith(null, false, false, false) .should.equal(true) }) }) - return describe('when read-write-sharing is enabled', function() { + describe('when read-write-sharing is enabled', function() { beforeEach(function() { this.TokenAccessHandler.ANONYMOUS_READ_AND_WRITE_ENABLED = true this.TokenAccessHandler.isValidToken = sinon @@ -238,7 +238,7 @@ describe('AuthorizationManager', function() { .should.equal(true) }) - return it('should give read-write access', function() { + it('should give read-write access', function() { return this.callback .calledWith(null, 'readAndWrite', false) .should.equal(true) @@ -246,7 +246,7 @@ describe('AuthorizationManager', function() { }) }) - return describe('when the token is valid for read-only', function() { + describe('when the token is valid for read-only', function() { beforeEach(function() { this.TokenAccessHandler.isValidToken = sinon .stub() @@ -278,7 +278,7 @@ describe('AuthorizationManager', function() { .should.equal(true) }) - return it('should give read-only access', function() { + it('should give read-only access', function() { return this.callback .calledWith(null, 'readOnly', false) .should.equal(true) @@ -310,7 +310,7 @@ describe('AuthorizationManager', function() { ) }) - return it("should return the user's privilege level", function() { + it("should return the user's privilege level", function() { return this.callback .calledWith(null, 'readOnly', false, false) .should.equal(true) @@ -333,7 +333,7 @@ describe('AuthorizationManager', function() { ) }) - return it('should return false', function() { + it('should return false', function() { return this.callback .calledWith(null, false, false, false) .should.equal(true) @@ -356,14 +356,14 @@ describe('AuthorizationManager', function() { ) }) - return it('should return the user as an owner', function() { + it('should return the user as an owner', function() { return this.callback .calledWith(null, 'owner', false, true) .should.equal(true) }) }) - return describe('with no user (anonymous)', function() { + describe('with no user (anonymous)', function() { beforeEach(function() { return this.AuthorizationManager.getPrivilegeLevelForProject( null, @@ -385,7 +385,7 @@ describe('AuthorizationManager', function() { ) }) - return it('should return false', function() { + it('should return false', function() { return this.callback .calledWith(null, false, false, false) .should.equal(true) @@ -416,7 +416,7 @@ describe('AuthorizationManager', function() { ) }) - return it("should return the user's privilege level", function() { + it("should return the user's privilege level", function() { return this.callback .calledWith(null, 'readOnly', false) .should.equal(true) @@ -439,7 +439,7 @@ describe('AuthorizationManager', function() { ) }) - return it('should return the public privilege level', function() { + it('should return the public privilege level', function() { return this.callback .calledWith(null, 'readAndWrite', true) .should.equal(true) @@ -462,14 +462,14 @@ describe('AuthorizationManager', function() { ) }) - return it('should return the user as an owner', function() { + it('should return the user as an owner', function() { return this.callback .calledWith(null, 'owner', false) .should.equal(true) }) }) - return describe('with no user (anonymous)', function() { + describe('with no user (anonymous)', function() { beforeEach(function() { return this.AuthorizationManager.getPrivilegeLevelForProject( null, @@ -491,7 +491,7 @@ describe('AuthorizationManager', function() { ) }) - return it('should return the public privilege level', function() { + it('should return the public privilege level', function() { return this.callback .calledWith(null, 'readAndWrite', true) .should.equal(true) @@ -506,7 +506,7 @@ describe('AuthorizationManager', function() { .yields(null, null) }) - return it('should return a NotFoundError', function() { + it('should return a NotFoundError', function() { return this.AuthorizationManager.getPrivilegeLevelForProject( this.user_id, this.project_id, @@ -516,7 +516,7 @@ describe('AuthorizationManager', function() { }) }) - return describe('when the project id is not valid', function() { + describe('when the project id is not valid', function() { beforeEach(function() { this.AuthorizationManager.isUserSiteAdmin .withArgs(this.user_id) @@ -526,7 +526,7 @@ describe('AuthorizationManager', function() { .yields(null, 'readOnly') }) - return it('should return a error', function(done) { + it('should return a error', function(done) { return this.AuthorizationManager.getPrivilegeLevelForProject( undefined, 'not project id', @@ -553,7 +553,7 @@ describe('AuthorizationManager', function() { .yields(null, 'owner', false) }) - return it('should return true', function(done) { + it('should return true', function(done) { return this.AuthorizationManager.canUserReadProject( this.user_id, this.project_id, @@ -573,7 +573,7 @@ describe('AuthorizationManager', function() { .yields(null, 'readAndWrite', false) }) - return it('should return true', function(done) { + it('should return true', function(done) { return this.AuthorizationManager.canUserReadProject( this.user_id, this.project_id, @@ -593,7 +593,7 @@ describe('AuthorizationManager', function() { .yields(null, 'readOnly', false) }) - return it('should return true', function(done) { + it('should return true', function(done) { return this.AuthorizationManager.canUserReadProject( this.user_id, this.project_id, @@ -606,14 +606,14 @@ describe('AuthorizationManager', function() { }) }) - return describe('when user has no access', function() { + describe('when user has no access', function() { beforeEach(function() { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, false, false) }) - return it('should return false', function(done) { + it('should return false', function(done) { return this.AuthorizationManager.canUserReadProject( this.user_id, this.project_id, @@ -639,7 +639,7 @@ describe('AuthorizationManager', function() { .yields(null, 'owner', false) }) - return it('should return true', function(done) { + it('should return true', function(done) { return this.AuthorizationManager.canUserWriteProjectContent( this.user_id, this.project_id, @@ -659,7 +659,7 @@ describe('AuthorizationManager', function() { .yields(null, 'readAndWrite', false) }) - return it('should return true', function(done) { + it('should return true', function(done) { return this.AuthorizationManager.canUserWriteProjectContent( this.user_id, this.project_id, @@ -679,7 +679,7 @@ describe('AuthorizationManager', function() { .yields(null, 'readOnly', false) }) - return it('should return false', function(done) { + it('should return false', function(done) { return this.AuthorizationManager.canUserWriteProjectContent( this.user_id, this.project_id, @@ -692,14 +692,14 @@ describe('AuthorizationManager', function() { }) }) - return describe('when user has no access', function() { + describe('when user has no access', function() { beforeEach(function() { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, false, false) }) - return it('should return false', function(done) { + it('should return false', function(done) { return this.AuthorizationManager.canUserWriteProjectContent( this.user_id, this.project_id, @@ -725,7 +725,7 @@ describe('AuthorizationManager', function() { .yields(null, 'owner', false) }) - return it('should return true', function(done) { + it('should return true', function(done) { return this.AuthorizationManager.canUserWriteProjectSettings( this.user_id, this.project_id, @@ -745,7 +745,7 @@ describe('AuthorizationManager', function() { .yields(null, 'readAndWrite', false) }) - return it('should return true', function(done) { + it('should return true', function(done) { return this.AuthorizationManager.canUserWriteProjectSettings( this.user_id, this.project_id, @@ -765,7 +765,7 @@ describe('AuthorizationManager', function() { .yields(null, 'readAndWrite', true) }) - return it('should return false', function(done) { + it('should return false', function(done) { return this.AuthorizationManager.canUserWriteProjectSettings( this.user_id, this.project_id, @@ -785,7 +785,7 @@ describe('AuthorizationManager', function() { .yields(null, 'readOnly', false) }) - return it('should return false', function(done) { + it('should return false', function(done) { return this.AuthorizationManager.canUserWriteProjectSettings( this.user_id, this.project_id, @@ -798,14 +798,14 @@ describe('AuthorizationManager', function() { }) }) - return describe('when user has no access', function() { + describe('when user has no access', function() { beforeEach(function() { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, false, false) }) - return it('should return false', function(done) { + it('should return false', function(done) { return this.AuthorizationManager.canUserWriteProjectSettings( this.user_id, this.project_id, @@ -831,7 +831,7 @@ describe('AuthorizationManager', function() { .yields(null, 'owner', false) }) - return it('should return true', function(done) { + it('should return true', function(done) { return this.AuthorizationManager.canUserAdminProject( this.user_id, this.project_id, @@ -851,7 +851,7 @@ describe('AuthorizationManager', function() { .yields(null, 'readAndWrite', false) }) - return it('should return false', function(done) { + it('should return false', function(done) { return this.AuthorizationManager.canUserAdminProject( this.user_id, this.project_id, @@ -871,7 +871,7 @@ describe('AuthorizationManager', function() { .yields(null, 'readOnly', false) }) - return it('should return false', function(done) { + it('should return false', function(done) { return this.AuthorizationManager.canUserAdminProject( this.user_id, this.project_id, @@ -884,14 +884,14 @@ describe('AuthorizationManager', function() { }) }) - return describe('when user has no access', function() { + describe('when user has no access', function() { beforeEach(function() { return this.AuthorizationManager.getPrivilegeLevelForProject .withArgs(this.user_id, this.project_id, this.token) .yields(null, false, false) }) - return it('should return false', function(done) { + it('should return false', function(done) { return this.AuthorizationManager.canUserAdminProject( this.user_id, this.project_id, @@ -905,7 +905,7 @@ describe('AuthorizationManager', function() { }) }) - return describe('isUserSiteAdmin', function() { + describe('isUserSiteAdmin', function() { beforeEach(function() { return (this.User.findOne = sinon.stub()) }) @@ -917,7 +917,7 @@ describe('AuthorizationManager', function() { .yields(null, { isAdmin: true }) }) - return it('should return true', function(done) { + it('should return true', function(done) { return this.AuthorizationManager.isUserSiteAdmin(this.user_id, function( error, isAdmin @@ -935,7 +935,7 @@ describe('AuthorizationManager', function() { .yields(null, { isAdmin: false }) }) - return it('should return false', function(done) { + it('should return false', function(done) { return this.AuthorizationManager.isUserSiteAdmin(this.user_id, function( error, isAdmin @@ -953,7 +953,7 @@ describe('AuthorizationManager', function() { .yields(null, null) }) - return it('should return false', function(done) { + it('should return false', function(done) { return this.AuthorizationManager.isUserSiteAdmin(this.user_id, function( error, isAdmin @@ -964,7 +964,7 @@ describe('AuthorizationManager', function() { }) }) - return describe('when no user is passed', () => + describe('when no user is passed', () => it('should return false', function(done) { return this.AuthorizationManager.isUserSiteAdmin( null, diff --git a/services/web/test/unit/src/Authorization/AuthorizationMiddlewareTests.js b/services/web/test/unit/src/Authorization/AuthorizationMiddlewareTests.js index 4e4997eb78..5d300c3bf7 100644 --- a/services/web/test/unit/src/Authorization/AuthorizationMiddlewareTests.js +++ b/services/web/test/unit/src/Authorization/AuthorizationMiddlewareTests.js @@ -85,7 +85,7 @@ describe('AuthorizationMiddleware', function() { ) }) - return it('should fall back to null', function(done) { + it('should fall back to null', function(done) { this.AuthenticationController.getLoggedInUserId = sinon .stub() .returns(null) @@ -122,7 +122,7 @@ describe('AuthorizationMiddleware', function() { return (this.req.params = {}) }) - return it('should return an error to next', function() { + it('should return an error to next', function() { this.AuthorizationMiddleware[middlewareMethod]( this.req, this.res, @@ -146,7 +146,7 @@ describe('AuthorizationMiddleware', function() { .yields(null, true) }) - return it('should return next', function() { + it('should return next', function() { this.AuthorizationMiddleware[middlewareMethod]( this.req, this.res, @@ -156,14 +156,14 @@ describe('AuthorizationMiddleware', function() { }) }) - return describe("when user doesn't have permission", function() { + describe("when user doesn't have permission", function() { beforeEach(function() { return this.AuthorizationManager[managerMethod] .withArgs(this.user_id, this.project_id, this.token) .yields(null, false) }) - return it('should redirect to redirectToRestricted', function() { + it('should redirect to redirectToRestricted', function() { this.AuthorizationMiddleware[middlewareMethod]( this.req, this.res, @@ -186,7 +186,7 @@ describe('AuthorizationMiddleware', function() { .yields(null, true) }) - return it('should return next', function() { + it('should return next', function() { this.AuthorizationMiddleware[middlewareMethod]( this.req, this.res, @@ -196,7 +196,7 @@ describe('AuthorizationMiddleware', function() { }) }) - return describe("when user doesn't have permission", function() { + describe("when user doesn't have permission", function() { beforeEach(function() { this.AuthenticationController.getLoggedInUserId.returns(null) return this.AuthorizationManager[managerMethod] @@ -204,7 +204,7 @@ describe('AuthorizationMiddleware', function() { .yields(null, false) }) - return it('should redirect to redirectToRestricted', function() { + it('should redirect to redirectToRestricted', function() { this.AuthorizationMiddleware[middlewareMethod]( this.req, this.res, @@ -218,13 +218,13 @@ describe('AuthorizationMiddleware', function() { }) }) - return describe('with malformed project id', function() { + describe('with malformed project id', function() { beforeEach(function() { this.req.params = { project_id: 'blah' } return (this.ObjectId.isValid = sinon.stub().returns(false)) }) - return it('should return a not found error', function(done) { + it('should return a not found error', function(done) { return this.AuthorizationMiddleware[middlewareMethod]( this.req, this.res, @@ -258,7 +258,7 @@ describe('AuthorizationMiddleware', function() { .yields(null, true) }) - return it('should return next', function() { + it('should return next', function() { this.AuthorizationMiddleware.ensureUserIsSiteAdmin( this.req, this.res, @@ -268,14 +268,14 @@ describe('AuthorizationMiddleware', function() { }) }) - return describe("when user doesn't have permission", function() { + describe("when user doesn't have permission", function() { beforeEach(function() { return this.AuthorizationManager.isUserSiteAdmin .withArgs(this.user_id) .yields(null, false) }) - return it('should redirect to redirectToRestricted', function() { + it('should redirect to redirectToRestricted', function() { this.AuthorizationMiddleware.ensureUserIsSiteAdmin( this.req, this.res, @@ -289,7 +289,7 @@ describe('AuthorizationMiddleware', function() { }) }) - return describe('with anonymous user', function() { + describe('with anonymous user', function() { describe('when user has permission', function() { beforeEach(function() { this.AuthenticationController.getLoggedInUserId.returns(null) @@ -298,7 +298,7 @@ describe('AuthorizationMiddleware', function() { .yields(null, true) }) - return it('should return next', function() { + it('should return next', function() { this.AuthorizationMiddleware.ensureUserIsSiteAdmin( this.req, this.res, @@ -308,7 +308,7 @@ describe('AuthorizationMiddleware', function() { }) }) - return describe("when user doesn't have permission", function() { + describe("when user doesn't have permission", function() { beforeEach(function() { this.AuthenticationController.getLoggedInUserId.returns(null) return this.AuthorizationManager.isUserSiteAdmin @@ -316,7 +316,7 @@ describe('AuthorizationMiddleware', function() { .yields(null, false) }) - return it('should redirect to redirectToRestricted', function() { + it('should redirect to redirectToRestricted', function() { this.AuthorizationMiddleware.ensureUserIsSiteAdmin( this.req, this.res, @@ -331,7 +331,7 @@ describe('AuthorizationMiddleware', function() { }) }) - return describe('ensureUserCanReadMultipleProjects', function() { + describe('ensureUserCanReadMultipleProjects', function() { beforeEach(function() { this.AuthorizationManager.canUserReadProject = sinon.stub() this.AuthorizationMiddleware.redirectToRestricted = sinon.stub() @@ -355,7 +355,7 @@ describe('AuthorizationMiddleware', function() { .yields(null, true) }) - return it('should return next', function() { + it('should return next', function() { this.AuthorizationMiddleware.ensureUserCanReadMultipleProjects( this.req, this.res, @@ -365,7 +365,7 @@ describe('AuthorizationMiddleware', function() { }) }) - return describe("when user doesn't have permission to access one of the projects", function() { + describe("when user doesn't have permission to access one of the projects", function() { beforeEach(function() { this.AuthorizationManager.canUserReadProject .withArgs(this.user_id, 'project1', this.token) @@ -375,7 +375,7 @@ describe('AuthorizationMiddleware', function() { .yields(null, false) }) - return it('should redirect to redirectToRestricted', function() { + it('should redirect to redirectToRestricted', function() { this.AuthorizationMiddleware.ensureUserCanReadMultipleProjects( this.req, this.res, @@ -389,7 +389,7 @@ describe('AuthorizationMiddleware', function() { }) }) - return describe('with anonymous user', () => + describe('with anonymous user', () => describe('when user has permission', function() { describe('when user has permission to access all projects', function() { beforeEach(function() { @@ -402,7 +402,7 @@ describe('AuthorizationMiddleware', function() { .yields(null, true) }) - return it('should return next', function() { + it('should return next', function() { this.AuthorizationMiddleware.ensureUserCanReadMultipleProjects( this.req, this.res, @@ -412,7 +412,7 @@ describe('AuthorizationMiddleware', function() { }) }) - return describe("when user doesn't have permission to access one of the projects", function() { + describe("when user doesn't have permission to access one of the projects", function() { beforeEach(function() { this.AuthenticationController.getLoggedInUserId.returns(null) this.AuthorizationManager.canUserReadProject @@ -423,7 +423,7 @@ describe('AuthorizationMiddleware', function() { .yields(null, false) }) - return it('should redirect to redirectToRestricted', function() { + it('should redirect to redirectToRestricted', function() { this.AuthorizationMiddleware.ensureUserCanReadMultipleProjects( this.req, this.res, diff --git a/services/web/test/unit/src/BetaProgram/BetaProgramControllerTests.js b/services/web/test/unit/src/BetaProgram/BetaProgramControllerTests.js index ee7f37e670..195e575883 100644 --- a/services/web/test/unit/src/BetaProgram/BetaProgramControllerTests.js +++ b/services/web/test/unit/src/BetaProgram/BetaProgramControllerTests.js @@ -94,7 +94,7 @@ describe('BetaProgramController', function() { return this.BetaProgramHandler.optIn.callCount.should.equal(1) }) - return describe('when BetaProgramHandler.opIn produces an error', function() { + describe('when BetaProgramHandler.opIn produces an error', function() { beforeEach(function() { return this.BetaProgramHandler.optIn.callsArgWith(1, new Error('woops')) }) @@ -104,7 +104,7 @@ describe('BetaProgramController', function() { return this.res.redirect.callCount.should.equal(0) }) - return it('should produce an error', function() { + it('should produce an error', function() { this.BetaProgramController.optIn(this.req, this.res, this.next) this.next.callCount.should.equal(1) return this.next.firstCall.args[0].should.be.instanceof(Error) @@ -140,7 +140,7 @@ describe('BetaProgramController', function() { return this.BetaProgramHandler.optOut.callCount.should.equal(1) }) - return describe('when BetaProgramHandler.optOut produces an error', function() { + describe('when BetaProgramHandler.optOut produces an error', function() { beforeEach(function() { return this.BetaProgramHandler.optOut.callsArgWith( 1, @@ -153,7 +153,7 @@ describe('BetaProgramController', function() { return this.res.redirect.callCount.should.equal(0) }) - return it('should produce an error', function() { + it('should produce an error', function() { this.BetaProgramController.optOut(this.req, this.res, this.next) this.next.callCount.should.equal(1) return this.next.firstCall.args[0].should.be.instanceof(Error) @@ -161,7 +161,7 @@ describe('BetaProgramController', function() { }) }) - return describe('optInPage', function() { + describe('optInPage', function() { beforeEach(function() { return this.UserGetter.getUser.callsArgWith(1, null, this.user) }) @@ -173,7 +173,7 @@ describe('BetaProgramController', function() { return args[0].should.equal('beta_program/opt_in') }) - return describe('when UserGetter.getUser produces an error', function() { + describe('when UserGetter.getUser produces an error', function() { beforeEach(function() { return this.UserGetter.getUser.callsArgWith(1, new Error('woops')) }) @@ -183,7 +183,7 @@ describe('BetaProgramController', function() { return this.res.render.callCount.should.equal(0) }) - return it('should produce an error', function() { + it('should produce an error', function() { this.BetaProgramController.optInPage(this.req, this.res, this.next) this.next.callCount.should.equal(1) return this.next.firstCall.args[0].should.be.instanceof(Error) diff --git a/services/web/test/unit/src/BetaProgram/BetaProgramHandlerTests.js b/services/web/test/unit/src/BetaProgram/BetaProgramHandlerTests.js index 657b5a57b1..76f1fa1809 100644 --- a/services/web/test/unit/src/BetaProgram/BetaProgramHandlerTests.js +++ b/services/web/test/unit/src/BetaProgram/BetaProgramHandlerTests.js @@ -80,12 +80,12 @@ describe('BetaProgramHandler', function() { }) }) - return describe('when user.save produces an error', function() { + describe('when user.save produces an error', function() { beforeEach(function() { return this.user.save.callsArgWith(0, new Error('woops')) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call(err => { expect(err).to.not.equal(null) expect(err).to.be.instanceof(Error) @@ -95,7 +95,7 @@ describe('BetaProgramHandler', function() { }) }) - return describe('optOut', function() { + describe('optOut', function() { beforeEach(function() { this.user.betaProgram = true return (this.call = callback => { @@ -125,12 +125,12 @@ describe('BetaProgramHandler', function() { }) }) - return describe('when user.save produces an error', function() { + describe('when user.save produces an error', function() { beforeEach(function() { return this.user.save.callsArgWith(0, new Error('woops')) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call(err => { expect(err).to.not.equal(null) expect(err).to.be.instanceof(Error) diff --git a/services/web/test/unit/src/Blog/BlogControllerTests.js b/services/web/test/unit/src/Blog/BlogControllerTests.js index a81bf06c2a..a84e60fe32 100644 --- a/services/web/test/unit/src/Blog/BlogControllerTests.js +++ b/services/web/test/unit/src/Blog/BlogControllerTests.js @@ -78,7 +78,7 @@ describe('BlogController', function() { return this.BlogController.getPage(this.req, this.res) }) - return it('should proxy the image urls', function(done) { + it('should proxy the image urls', function(done) { this.BlogController._directProxy = sinon.stub() this.req.url = '/something.png' this.BlogController.getPage(this.req, this.res) @@ -89,7 +89,7 @@ describe('BlogController', function() { }) }) - return describe('getIndexPage', () => + describe('getIndexPage', () => it('should change the url and send it to getPage', function(done) { this.req.url = '/blog' this.BlogController.getPage = function(req, res) { diff --git a/services/web/test/unit/src/BrandVariations/BrandVariationsHandlerTests.js b/services/web/test/unit/src/BrandVariations/BrandVariationsHandlerTests.js index 525a68b758..61ce2022e7 100644 --- a/services/web/test/unit/src/BrandVariations/BrandVariationsHandlerTests.js +++ b/services/web/test/unit/src/BrandVariations/BrandVariationsHandlerTests.js @@ -54,7 +54,7 @@ describe('BrandVariationsHandler', function() { }) }) - return describe('getBrandVariationById', function() { + describe('getBrandVariationById', function() { it('should call the callback with an error when the branding variation id is not provided', function(done) { return this.BrandVariationsHandler.getBrandVariationById( null, @@ -95,7 +95,7 @@ describe('BrandVariationsHandler', function() { ) }) - return it('should transform relative URLs in v1 absolute ones', function(done) { + it('should transform relative URLs in v1 absolute ones', function(done) { this.mockedBrandVariationDetails.logo_url = '/journal-logo.png' this.V1Api.request.callsArgWith( 1, diff --git a/services/web/test/unit/src/Chat/ChatApiHandlerTests.js b/services/web/test/unit/src/Chat/ChatApiHandlerTests.js index 41d77c2fa6..2378245a5b 100644 --- a/services/web/test/unit/src/Chat/ChatApiHandlerTests.js +++ b/services/web/test/unit/src/Chat/ChatApiHandlerTests.js @@ -72,12 +72,12 @@ describe('ChatApiHandler', function() { .should.equal(true) }) - return it('should return the message from the post', function() { + it('should return the message from the post', function() { return this.callback.calledWith(null, this.message).should.equal(true) }) }) - return describe('with a non-success status code', function() { + describe('with a non-success status code', function() { beforeEach(function() { this.request.callsArgWith(1, null, { statusCode: 500 }) return this.ChatApiHandler.sendGlobalMessage( @@ -88,7 +88,7 @@ describe('ChatApiHandler', function() { ) }) - return it('should return an error', function() { + it('should return an error', function() { const error = new Error() error.statusCode = 500 return this.callback.calledWith(error).should.equal(true) @@ -96,7 +96,7 @@ describe('ChatApiHandler', function() { }) }) - return describe('getGlobalMessages', function() { + describe('getGlobalMessages', function() { beforeEach(function() { this.messages = [{ mock: 'message' }] this.limit = 30 @@ -130,12 +130,12 @@ describe('ChatApiHandler', function() { .should.equal(true) }) - return it('should return the messages from the request', function() { + it('should return the messages from the request', function() { return this.callback.calledWith(null, this.messages).should.equal(true) }) }) - return describe('with failure error code', function() { + describe('with failure error code', function() { beforeEach(function() { this.request.callsArgWith(1, null, { statusCode: 500 }, null) return this.ChatApiHandler.getGlobalMessages( @@ -146,7 +146,7 @@ describe('ChatApiHandler', function() { ) }) - return it('should return an error', function() { + it('should return an error', function() { const error = new Error() error.statusCode = 500 return this.callback.calledWith(error).should.equal(true) diff --git a/services/web/test/unit/src/Chat/ChatControllerTests.js b/services/web/test/unit/src/Chat/ChatControllerTests.js index 17887e2640..b72554fea5 100644 --- a/services/web/test/unit/src/Chat/ChatControllerTests.js +++ b/services/web/test/unit/src/Chat/ChatControllerTests.js @@ -101,7 +101,7 @@ describe('ChatController', function() { .should.equal(true) }) - return it('should return a 204 status code', function() { + it('should return a 204 status code', function() { return this.res.send.calledWith(204).should.equal(true) }) }) @@ -125,12 +125,12 @@ describe('ChatController', function() { .should.equal(true) }) - return it('should return the messages', function() { + it('should return the messages', function() { return this.res.json.calledWith(this.messages).should.equal(true) }) }) - return describe('_injectUserInfoIntoThreads', function() { + describe('_injectUserInfoIntoThreads', function() { beforeEach(function() { this.users = { user_id_1: { @@ -209,7 +209,7 @@ describe('ChatController', function() { ) }) - return it('should only need to look up each user once', function(done) { + it('should only need to look up each user once', function(done) { return this.ChatController._injectUserInfoIntoThreads( [ { diff --git a/services/web/test/unit/src/Collaborators/CollaboratorsControllerTests.js b/services/web/test/unit/src/Collaborators/CollaboratorsControllerTests.js index 3fd46c4ef0..fdaa21d621 100644 --- a/services/web/test/unit/src/Collaborators/CollaboratorsControllerTests.js +++ b/services/web/test/unit/src/Collaborators/CollaboratorsControllerTests.js @@ -77,7 +77,7 @@ describe('CollaboratorsController', function() { return this.res.sendStatus.calledWith(204).should.equal(true) }) - return it('should have called emitToRoom', function() { + it('should have called emitToRoom', function() { return this.EditorRealTimeController.emitToRoom .calledWith(this.project_id, 'project:membership:changed') .should.equal(true) @@ -109,12 +109,12 @@ describe('CollaboratorsController', function() { .should.equal(true) }) - return it('should return a success code', function() { + it('should return a success code', function() { return this.res.sendStatus.calledWith(204).should.equal(true) }) }) - return describe('getAllMembers', function() { + describe('getAllMembers', function() { beforeEach(function() { this.req.session = { user: { _id: (this.user_id = 'user-id-123') } } this.req.params = { Project_id: this.project_id } @@ -148,7 +148,7 @@ describe('CollaboratorsController', function() { ) }) - return describe('when CollaboratorsHandler.getAllInvitedMembers produces an error', function() { + describe('when CollaboratorsHandler.getAllInvitedMembers produces an error', function() { beforeEach(function() { this.res.json = sinon.stub() this.next = sinon.stub() @@ -167,7 +167,7 @@ describe('CollaboratorsController', function() { return this.next.firstCall.args[0].should.be.instanceof(Error) }) - return it('should not produce a json response', function() { + it('should not produce a json response', function() { return this.res.json.callCount.should.equal(0) }) }) diff --git a/services/web/test/unit/src/Collaborators/CollaboratorsHandlerTests.js b/services/web/test/unit/src/Collaborators/CollaboratorsHandlerTests.js index d7e7a3624b..7144e26478 100644 --- a/services/web/test/unit/src/Collaborators/CollaboratorsHandlerTests.js +++ b/services/web/test/unit/src/Collaborators/CollaboratorsHandlerTests.js @@ -82,7 +82,7 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should return an array of member ids with their privilege levels', function() { + it('should return an array of member ids with their privilege levels', function() { return this.callback .calledWith(null, [ { id: 'owner-ref', privilegeLevel: 'owner', source: 'owner' }, @@ -111,12 +111,12 @@ describe('CollaboratorsHandler', function() { }) }) - return describe('with a missing project', function() { + describe('with a missing project', function() { beforeEach(function() { return (this.ProjectGetter.getProject = sinon.stub().yields(null, null)) }) - return it('should return a NotFoundError', function(done) { + it('should return a NotFoundError', function(done) { return this.CollaboratorHandler.getMemberIdsWithPrivilegeLevels( this.project_id, function(error) { @@ -143,7 +143,7 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should return the ids', function() { + it('should return the ids', function() { return this.callback .calledWith(null, ['member-id-1', 'member-id-2']) .should.equal(true) @@ -165,7 +165,7 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should return the invited ids', function() { + it('should return the invited ids', function() { return this.callback.calledWith(null, ['member-id-1']).should.equal(true) }) }) @@ -224,7 +224,7 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should return an array of members with their privilege levels', function() { + it('should return an array of members with their privilege levels', function() { return this.callback .calledWith(null, [ { user: { _id: 'read-only-ref-1' }, privilegeLevel: 'readOnly' }, @@ -290,7 +290,7 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should return an array of invited members with their privilege levels', function() { + it('should return an array of invited members with their privilege levels', function() { return this.callback .calledWith(null, [ { user: { _id: 'read-only-ref-2' }, privilegeLevel: 'readOnly' }, @@ -354,7 +354,7 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should return an array of token members with their privilege levels', function() { + it('should return an array of token members with their privilege levels', function() { return this.callback .calledWith(null, [ { user: { _id: 'read-only-ref-1' }, privilegeLevel: 'readOnly' }, @@ -386,7 +386,7 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should return false if the member has no privilege level', function(done) { + it('should return false if the member has no privilege level', function(done) { return this.CollaboratorHandler.getMemberIdPrivilegeLevel( 'member-id-3', this.project_id, @@ -426,14 +426,14 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should return true and the privilegeLevel', function() { + it('should return true and the privilegeLevel', function() { return this.callback .calledWith(null, true, 'readAndWrite') .should.equal(true) }) }) - return describe('when user is not a member of the project', function() { + describe('when user is not a member of the project', function() { beforeEach(function() { this.CollaboratorHandler.getMemberIdsWithPrivilegeLevels .withArgs(this.project_id) @@ -445,7 +445,7 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should return false', function() { + it('should return false', function() { return this.callback.calledWith(null, false, null).should.equal(true) }) }) @@ -495,7 +495,7 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should call the callback with the projects', function() { + it('should call the callback with the projects', function() { return this.callback .calledWith(null, { readAndWrite: [ @@ -526,7 +526,7 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should remove the user from mongo', function() { + it('should remove the user from mongo', function() { return this.Project.update .calledWith( { @@ -590,7 +590,7 @@ describe('CollaboratorsHandler', function() { .should.equal(true) }) - return it('should add the user as a contact for the adding user', function() { + it('should add the user as a contact for the adding user', function() { return this.ContactManager.addContact .calledWith(this.adding_user_id, this.user_id) .should.equal(true) @@ -621,7 +621,7 @@ describe('CollaboratorsHandler', function() { .should.equal(true) }) - return it('should flush the project to the TPDS', function() { + it('should flush the project to the TPDS', function() { return this.ProjectEntityHandler.flushProjectToThirdPartyDataStore .calledWith(this.project_id) .should.equal(true) @@ -639,7 +639,7 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should call the callback with an error', function() { + it('should call the callback with an error', function() { return this.callback.calledWith(new Error()).should.equal(true) }) }) @@ -656,12 +656,12 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should not add the user again', function() { + it('should not add the user again', function() { return this.Project.update.called.should.equal(false) }) }) - return describe('with null adding_user_id', function() { + describe('with null adding_user_id', function() { beforeEach(function() { return this.CollaboratorHandler.addUserIdToProject( this.project_id, @@ -672,7 +672,7 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should not add the adding user as a contact', function() { + it('should not add the adding user as a contact', function() { return this.ContactManager.addContact.called.should.equal(false) }) }) @@ -708,7 +708,7 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should remove the user from each project', function() { + it('should remove the user from each project', function() { const expectedProjects = [ 'read-and-write-0', 'read-and-write-1', @@ -793,7 +793,7 @@ describe('CollaboratorsHandler', function() { ) }) - return describe('when getMembersWithPrivileges produces an error', function() { + describe('when getMembersWithPrivileges produces an error', function() { beforeEach(function() { this.CollaboratorHandler.getInvitedMembersWithPrivilegeLevels = sinon .stub() @@ -834,7 +834,7 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should not call ProjectEditorHandler.buildOwnerAndMembersViews', function() { + it('should not call ProjectEditorHandler.buildOwnerAndMembersViews', function() { return this.ProjectEditorHandler.buildOwnerAndMembersViews.callCount.should.equal( 0 ) @@ -875,7 +875,7 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should return false when the project is not found', function(done) { + it('should return false when the project is not found', function(done) { this.project = null this.Project.findOne = sinon.stub().callsArgWith(2, null, this.project) return this.CollaboratorHandler.userIsTokenMember( @@ -890,7 +890,7 @@ describe('CollaboratorsHandler', function() { }) }) - return describe('transferProjects', function() { + describe('transferProjects', function() { beforeEach(function() { this.from_user_id = 'from-user-id' this.to_user_id = 'to-user-id' @@ -1012,12 +1012,12 @@ describe('CollaboratorsHandler', function() { ) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) - return describe('when flushing to TPDS fails', function() { + describe('when flushing to TPDS fails', function() { beforeEach(function() { this.ProjectEntityHandler.flushProjectToThirdPartyDataStore = sinon .stub() @@ -1033,7 +1033,7 @@ describe('CollaboratorsHandler', function() { return this.logger.err.called.should.equal(true) }) - return it('should not return an error since it happens in the background', function() { + it('should not return an error since it happens in the background', function() { this.callback.called.should.equal(true) return this.callback.calledWith(new Error('oops')).should.equal(false) }) diff --git a/services/web/test/unit/src/Collaborators/CollaboratorsInviteControllerTests.js b/services/web/test/unit/src/Collaborators/CollaboratorsInviteControllerTests.js index 5e0816b895..64496d9032 100644 --- a/services/web/test/unit/src/Collaborators/CollaboratorsInviteControllerTests.js +++ b/services/web/test/unit/src/Collaborators/CollaboratorsInviteControllerTests.js @@ -107,7 +107,7 @@ describe('CollaboratorsInviteController', function() { .should.equal(true) }) - return it('should have called CollaboratorsInviteHandler.getAllInvites', function() { + it('should have called CollaboratorsInviteHandler.getAllInvites', function() { this.CollaboratorsInviteHandler.getAllInvites.callCount.should.equal(1) return this.CollaboratorsInviteHandler.getAllInvites .calledWith(this.project_id) @@ -115,7 +115,7 @@ describe('CollaboratorsInviteController', function() { }) }) - return describe('when CollaboratorsInviteHandler.getAllInvites produces an error', function() { + describe('when CollaboratorsInviteHandler.getAllInvites produces an error', function() { beforeEach(function() { this.CollaboratorsInviteHandler.getAllInvites = sinon .stub() @@ -127,7 +127,7 @@ describe('CollaboratorsInviteController', function() { ) }) - return it('should produce an error', function() { + it('should produce an error', function() { this.next.callCount.should.equal(1) return this.next.firstCall.args[0].should.be.instanceof(Error) }) @@ -220,7 +220,7 @@ describe('CollaboratorsInviteController', function() { .should.equal(true) }) - return it('should have called emitToRoom', function() { + it('should have called emitToRoom', function() { this.EditorRealTimeController.emitToRoom.callCount.should.equal(1) return this.EditorRealTimeController.emitToRoom .calledWith(this.project_id, 'project:membership:changed') @@ -262,7 +262,7 @@ describe('CollaboratorsInviteController', function() { .should.equal(false) }) - return it('should not have called inviteToProject', function() { + it('should not have called inviteToProject', function() { return this.CollaboratorsInviteHandler.inviteToProject.callCount.should.equal( 0 ) @@ -301,7 +301,7 @@ describe('CollaboratorsInviteController', function() { .should.equal(false) }) - return it('should not have called inviteToProject', function() { + it('should not have called inviteToProject', function() { return this.CollaboratorsInviteHandler.inviteToProject.callCount.should.equal( 0 ) @@ -348,7 +348,7 @@ describe('CollaboratorsInviteController', function() { .should.equal(true) }) - return it('should have called inviteToProject', function() { + it('should have called inviteToProject', function() { this.CollaboratorsInviteHandler.inviteToProject.callCount.should.equal( 1 ) @@ -398,7 +398,7 @@ describe('CollaboratorsInviteController', function() { .should.equal(true) }) - return it('should not have called inviteToProject', function() { + it('should not have called inviteToProject', function() { return this.CollaboratorsInviteHandler.inviteToProject.callCount.should.equal( 0 ) @@ -437,7 +437,7 @@ describe('CollaboratorsInviteController', function() { .should.equal(true) }) - return it('should not have called inviteToProject', function() { + it('should not have called inviteToProject', function() { return this.CollaboratorsInviteHandler.inviteToProject.callCount.should.equal( 0 ) @@ -489,14 +489,14 @@ describe('CollaboratorsInviteController', function() { ) }) - return it('should not have called emitToRoom', function() { + it('should not have called emitToRoom', function() { return this.EditorRealTimeController.emitToRoom.callCount.should.equal( 0 ) }) }) - return describe('when _checkRateLimit returns false', function() { + describe('when _checkRateLimit returns false', function() { beforeEach(function() { this.CollaboratorsInviteController._checkShouldInviteEmail = sinon .stub() @@ -524,7 +524,7 @@ describe('CollaboratorsInviteController', function() { ) }) - return it('should not call emitToRoom', function() { + it('should not call emitToRoom', function() { return this.EditorRealTimeController.emitToRoom.called.should.equal( false ) @@ -627,7 +627,7 @@ describe('CollaboratorsInviteController', function() { .should.equal(true) }) - return it('should call ProjectGetter.getProject', function() { + it('should call ProjectGetter.getProject', function() { this.ProjectGetter.getProject.callCount.should.equal(1) return this.ProjectGetter.getProject .calledWith(this.project_id) @@ -677,7 +677,7 @@ describe('CollaboratorsInviteController', function() { return this.UserGetter.getUser.callCount.should.equal(0) }) - return it('should not call ProjectGetter.getProject', function() { + it('should not call ProjectGetter.getProject', function() { return this.ProjectGetter.getProject.callCount.should.equal(0) }) }) @@ -718,7 +718,7 @@ describe('CollaboratorsInviteController', function() { return this.UserGetter.getUser.callCount.should.equal(0) }) - return it('should not call ProjectGetter.getProject', function() { + it('should not call ProjectGetter.getProject', function() { return this.ProjectGetter.getProject.callCount.should.equal(0) }) }) @@ -764,7 +764,7 @@ describe('CollaboratorsInviteController', function() { return this.UserGetter.getUser.callCount.should.equal(0) }) - return it('should not call ProjectGetter.getProject', function() { + it('should not call ProjectGetter.getProject', function() { return this.ProjectGetter.getProject.callCount.should.equal(0) }) }) @@ -816,7 +816,7 @@ describe('CollaboratorsInviteController', function() { return this.UserGetter.getUser.callCount.should.equal(0) }) - return it('should not call ProjectGetter.getProject', function() { + it('should not call ProjectGetter.getProject', function() { return this.ProjectGetter.getProject.callCount.should.equal(0) }) }) @@ -858,7 +858,7 @@ describe('CollaboratorsInviteController', function() { .should.equal(true) }) - return it('should not call ProjectGetter.getProject', function() { + it('should not call ProjectGetter.getProject', function() { return this.ProjectGetter.getProject.callCount.should.equal(0) }) }) @@ -906,7 +906,7 @@ describe('CollaboratorsInviteController', function() { .should.equal(true) }) - return it('should not call ProjectGetter.getProject', function() { + it('should not call ProjectGetter.getProject', function() { return this.ProjectGetter.getProject.callCount.should.equal(0) }) }) @@ -948,12 +948,12 @@ describe('CollaboratorsInviteController', function() { .should.equal(true) }) - return it('should call ProjectGetter.getProject', function() { + it('should call ProjectGetter.getProject', function() { return this.ProjectGetter.getProject.callCount.should.equal(1) }) }) - return describe('when Project.getUser does not find a user', function() { + describe('when Project.getUser does not find a user', function() { beforeEach(function() { this.ProjectGetter.getProject.callsArgWith(2, null, null) return this.CollaboratorsInviteController.viewInvite( @@ -996,7 +996,7 @@ describe('CollaboratorsInviteController', function() { .should.equal(true) }) - return it('should call ProjectGetter.getProject', function() { + it('should call ProjectGetter.getProject', function() { return this.ProjectGetter.getProject.callCount.should.equal(1) }) }) @@ -1043,14 +1043,14 @@ describe('CollaboratorsInviteController', function() { ) }) - return it('should check the rate limit', function() { + it('should check the rate limit', function() { return this.CollaboratorsInviteController._checkRateLimit.callCount.should.equal( 1 ) }) }) - return describe('when resendInvite produces an error', function() { + describe('when resendInvite produces an error', function() { beforeEach(function() { this.err = new Error('woops') this.CollaboratorsInviteHandler.resendInvite = sinon @@ -1072,7 +1072,7 @@ describe('CollaboratorsInviteController', function() { return this.next.calledWith(this.err).should.equal(true) }) - return it('should have called resendInvite', function() { + it('should have called resendInvite', function() { return this.CollaboratorsInviteHandler.resendInvite.callCount.should.equal( 1 ) @@ -1117,7 +1117,7 @@ describe('CollaboratorsInviteController', function() { ) }) - return it('should have called emitToRoom', function() { + it('should have called emitToRoom', function() { this.EditorRealTimeController.emitToRoom.callCount.should.equal(1) return this.EditorRealTimeController.emitToRoom .calledWith(this.project_id, 'project:membership:changed') @@ -1125,7 +1125,7 @@ describe('CollaboratorsInviteController', function() { }) }) - return describe('when revokeInvite produces an error', function() { + describe('when revokeInvite produces an error', function() { beforeEach(function() { this.err = new Error('woops') this.CollaboratorsInviteHandler.revokeInvite = sinon @@ -1147,7 +1147,7 @@ describe('CollaboratorsInviteController', function() { return this.next.calledWith(this.err).should.equal(true) }) - return it('should have called revokeInvite', function() { + it('should have called revokeInvite', function() { return this.CollaboratorsInviteHandler.revokeInvite.callCount.should.equal( 1 ) @@ -1195,7 +1195,7 @@ describe('CollaboratorsInviteController', function() { .should.equal(true) }) - return it('should have called emitToRoom', function() { + it('should have called emitToRoom', function() { this.EditorRealTimeController.emitToRoom.callCount.should.equal(1) return this.EditorRealTimeController.emitToRoom .calledWith(this.project_id, 'project:membership:changed') @@ -1203,7 +1203,7 @@ describe('CollaboratorsInviteController', function() { }) }) - return describe('when revokeInvite produces an error', function() { + describe('when revokeInvite produces an error', function() { beforeEach(function() { this.err = new Error('woops') this.CollaboratorsInviteHandler.acceptInvite = sinon @@ -1225,7 +1225,7 @@ describe('CollaboratorsInviteController', function() { return this.next.calledWith(this.err).should.equal(true) }) - return it('should have called acceptInvite', function() { + it('should have called acceptInvite', function() { return this.CollaboratorsInviteHandler.acceptInvite.callCount.should.equal( 1 ) @@ -1238,7 +1238,7 @@ describe('CollaboratorsInviteController', function() { return (this.email = 'user@example.com') }) - return describe('when we should be restricting to existing accounts', function() { + describe('when we should be restricting to existing accounts', function() { beforeEach(function() { this.settings.restrictInvitesToExistingAccounts = true return (this.call = callback => { @@ -1257,7 +1257,7 @@ describe('CollaboratorsInviteController', function() { .callsArgWith(2, null, this.user)) }) - return it('should callback with `true`', function(done) { + it('should callback with `true`', function(done) { return this.call((err, shouldAllow) => { expect(err).to.equal(null) expect(shouldAllow).to.equal(true) @@ -1282,7 +1282,7 @@ describe('CollaboratorsInviteController', function() { }) }) - return it('should have called getUser', function(done) { + it('should have called getUser', function(done) { return this.call((err, shouldAllow) => { this.UserGetter.getUserByAnyEmail.callCount.should.equal(1) this.UserGetter.getUserByAnyEmail @@ -1293,7 +1293,7 @@ describe('CollaboratorsInviteController', function() { }) }) - return describe('when getUser produces an error', function() { + describe('when getUser produces an error', function() { beforeEach(function() { this.user = null return (this.UserGetter.getUserByAnyEmail = sinon @@ -1301,7 +1301,7 @@ describe('CollaboratorsInviteController', function() { .callsArgWith(2, new Error('woops'))) }) - return it('should callback with an error', function(done) { + it('should callback with an error', function(done) { return this.call((err, shouldAllow) => { expect(err).to.not.equal(null) expect(err).to.be.instanceof(Error) @@ -1313,7 +1313,7 @@ describe('CollaboratorsInviteController', function() { }) }) - return describe('_checkRateLimit', function() { + describe('_checkRateLimit', function() { beforeEach(function() { this.settings.restrictInvitesToExistingAccounts = false this.sendingUserId = '32312313' @@ -1372,7 +1372,7 @@ describe('CollaboratorsInviteController', function() { ) }) - return it('should call rate limiter with 10 when user has no collaborators set', function(done) { + it('should call rate limiter with 10 when user has no collaborators set', function(done) { this.LimitationsManager.allowedNumberOfCollaboratorsForUser .withArgs(this.sendingUserId) .yields(null) diff --git a/services/web/test/unit/src/Collaborators/CollaboratorsInviteHandlerTests.js b/services/web/test/unit/src/Collaborators/CollaboratorsInviteHandlerTests.js index f4b5f71390..27aec6b6fa 100644 --- a/services/web/test/unit/src/Collaborators/CollaboratorsInviteHandlerTests.js +++ b/services/web/test/unit/src/Collaborators/CollaboratorsInviteHandlerTests.js @@ -125,12 +125,12 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return describe('when model.count produces an error', function() { + describe('when model.count produces an error', function() { beforeEach(function() { return this.ProjectInvite.count.callsArgWith(1, new Error('woops')) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, count) => { expect(err).to.be.instanceof(Error) return done() @@ -173,7 +173,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should have called ProjectInvite.find', function(done) { + it('should have called ProjectInvite.find', function(done) { return this.call((err, invites) => { this.ProjectInvite.find.callCount.should.equal(1) this.ProjectInvite.find @@ -184,12 +184,12 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return describe('when ProjectInvite.find produces an error', function() { + describe('when ProjectInvite.find produces an error', function() { beforeEach(function() { return this.ProjectInvite.find.callsArgWith(1, new Error('woops')) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, invites) => { expect(err).to.be.instanceof(Error) return done() @@ -264,7 +264,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should have called _sendMessages', function(done) { + it('should have called _sendMessages', function(done) { return this.call((err, invite) => { this.CollaboratorsInviteHandler._sendMessages.callCount.should.equal( 1 @@ -277,14 +277,14 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return describe('when saving model produces an error', function() { + describe('when saving model produces an error', function() { beforeEach(function() { return (this.ProjectInvite.prototype.save = sinon.spy(function(cb) { return cb(new Error('woops'), this) })) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, invite) => { expect(err).to.be.instanceof(Error) return done() @@ -332,7 +332,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should call _trySendInviteNotification', function(done) { + it('should call _trySendInviteNotification', function(done) { return this.call(err => { this.CollaboratorsInviteHandler._trySendInviteNotification.callCount.should.equal( 1 @@ -359,7 +359,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should not call _trySendInviteNotification', function(done) { + it('should not call _trySendInviteNotification', function(done) { return this.call(err => { this.CollaboratorsInviteHandler._trySendInviteNotification.callCount.should.equal( 0 @@ -369,14 +369,14 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return describe('when _trySendInviteNotification produces an error', function() { + describe('when _trySendInviteNotification produces an error', function() { beforeEach(function() { return (this.CollaboratorsInviteHandler._trySendInviteNotification = sinon .stub() .callsArgWith(3, new Error('woops'))) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, invite) => { expect(err).to.be.instanceof(Error) return done() @@ -421,7 +421,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should call _tryCancelInviteNotification', function(done) { + it('should call _tryCancelInviteNotification', function(done) { return this.call(err => { this.CollaboratorsInviteHandler._tryCancelInviteNotification.callCount.should.equal( 1 @@ -434,12 +434,12 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return describe('when remove produces an error', function() { + describe('when remove produces an error', function() { beforeEach(function() { return this.ProjectInvite.remove.callsArgWith(1, new Error('woops')) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call(err => { expect(err).to.be.instanceof(Error) return done() @@ -485,7 +485,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should have called _sendMessages', function(done) { + it('should have called _sendMessages', function(done) { return this.call((err, invite) => { this.CollaboratorsInviteHandler._sendMessages.callCount.should.equal( 1 @@ -510,7 +510,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should not have called _sendMessages', function(done) { + it('should not have called _sendMessages', function(done) { return this.call((err, invite) => { this.CollaboratorsInviteHandler._sendMessages.callCount.should.equal( 0 @@ -520,7 +520,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return describe('when findOne does not find an invite', function() { + describe('when findOne does not find an invite', function() { beforeEach(function() { return this.ProjectInvite.findOne.callsArgWith(1, null, null) }) @@ -533,7 +533,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should not have called _sendMessages', function(done) { + it('should not have called _sendMessages', function(done) { return this.call((err, invite) => { this.CollaboratorsInviteHandler._sendMessages.callCount.should.equal( 0 @@ -574,7 +574,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should call ProjectInvite.findOne', function(done) { + it('should call ProjectInvite.findOne', function(done) { return this.call((err, invite) => { this.ProjectInvite.findOne.callCount.should.equal(1) this.ProjectInvite.findOne @@ -590,7 +590,7 @@ describe('CollaboratorsInviteHandler', function() { return this.ProjectInvite.findOne.callsArgWith(1, new Error('woops')) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, invite) => { expect(err).to.be.instanceof(Error) return done() @@ -598,7 +598,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return describe('when findOne does not find an invite', function() { + describe('when findOne does not find an invite', function() { beforeEach(function() { return this.ProjectInvite.findOne.callsArgWith(1, null, null) }) @@ -611,7 +611,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should not produce an invite object', function(done) { + it('should not produce an invite object', function(done) { return this.call((err, invite) => { expect(invite).to.not.be.instanceof(Error) expect(invite).to.be.oneOf([null, undefined]) @@ -688,7 +688,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should have called ProjectInvite.remove', function(done) { + it('should have called ProjectInvite.remove', function(done) { return this.call(err => { this.ProjectInvite.remove.callCount.should.equal(1) this.ProjectInvite.remove @@ -713,7 +713,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should have called CollaboratorsHandler.addUserIdToProject', function(done) { + it('should have called CollaboratorsHandler.addUserIdToProject', function(done) { return this.call(err => { this.CollaboratorsHandler.addUserIdToProject.callCount.should.equal(1) this.CollaboratorsHandler.addUserIdToProject @@ -759,7 +759,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should not have called ProjectInvite.remove', function(done) { + it('should not have called ProjectInvite.remove', function(done) { return this.call(err => { this.ProjectInvite.remove.callCount.should.equal(0) return done() @@ -796,7 +796,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should not have called ProjectInvite.remove', function(done) { + it('should not have called ProjectInvite.remove', function(done) { return this.call(err => { this.ProjectInvite.remove.callCount.should.equal(0) return done() @@ -844,7 +844,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should not have called ProjectInvite.remove', function(done) { + it('should not have called ProjectInvite.remove', function(done) { return this.call(err => { this.ProjectInvite.remove.callCount.should.equal(0) return done() @@ -852,7 +852,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return describe('when ProjectInvite.remove produces an error', function() { + describe('when ProjectInvite.remove produces an error', function() { beforeEach(function() { return this.ProjectInvite.remove.callsArgWith(1, new Error('woops')) }) @@ -889,7 +889,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should have called ProjectInvite.remove', function(done) { + it('should have called ProjectInvite.remove', function(done) { return this.call(err => { this.ProjectInvite.remove.callCount.should.equal(1) return done() @@ -928,7 +928,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return describe('when notification.read produces an error', function() { + describe('when notification.read produces an error', function() { beforeEach(function() { this.notification = { read: sinon.stub().callsArgWith(0, new Error('woops')) @@ -938,7 +938,7 @@ describe('CollaboratorsInviteHandler', function() { .returns(this.notification)) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call(err => { expect(err).to.be.instanceof(Error) return done() @@ -947,7 +947,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return describe('_trySendInviteNotification', function() { + describe('_trySendInviteNotification', function() { beforeEach(function() { this.invite = { _id: ObjectId(), @@ -1039,7 +1039,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should not call NotificationsBuilder.projectInvite.create', function(done) { + it('should not call NotificationsBuilder.projectInvite.create', function(done) { return this.call(err => { this.NotificationsBuilder.projectInvite.callCount.should.equal(0) this.notification.create.callCount.should.equal(0) @@ -1048,12 +1048,12 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return describe('when projectInvite.create produces an error', function() { + describe('when projectInvite.create produces an error', function() { beforeEach(function() { return this.notification.create.callsArgWith(0, new Error('woops')) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call(err => { expect(err).to.be.instanceof(Error) return done() @@ -1093,7 +1093,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should not call NotificationsBuilder.projectInvite.create', function(done) { + it('should not call NotificationsBuilder.projectInvite.create', function(done) { return this.call(err => { this.NotificationsBuilder.projectInvite.callCount.should.equal(0) this.notification.create.callCount.should.equal(0) @@ -1102,7 +1102,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return describe('when the getUser produces an error', function() { + describe('when the getUser produces an error', function() { beforeEach(function() { return (this.UserGetter.getUserByAnyEmail = sinon .stub() @@ -1133,7 +1133,7 @@ describe('CollaboratorsInviteHandler', function() { }) }) - return it('should not call NotificationsBuilder.projectInvite.create', function(done) { + it('should not call NotificationsBuilder.projectInvite.create', function(done) { return this.call(err => { this.NotificationsBuilder.projectInvite.callCount.should.equal(0) this.notification.create.callCount.should.equal(0) diff --git a/services/web/test/unit/src/Compile/ClsiCookieManagerTests.js b/services/web/test/unit/src/Compile/ClsiCookieManagerTests.js index ea17d4ef5c..420b7c6040 100644 --- a/services/web/test/unit/src/Compile/ClsiCookieManagerTests.js +++ b/services/web/test/unit/src/Compile/ClsiCookieManagerTests.js @@ -105,7 +105,7 @@ describe('ClsiCookieManager', function() { ) }) - return it('should _populateServerIdViaRequest if no key is blank', function(done) { + it('should _populateServerIdViaRequest if no key is blank', function(done) { this.ClsiCookieManager._populateServerIdViaRequest = sinon .stub() .callsArgWith(1) @@ -143,7 +143,7 @@ describe('ClsiCookieManager', function() { ) }) - return it('should return the server id', function(done) { + it('should return the server id', function(done) { return this.ClsiCookieManager._populateServerIdViaRequest( this.project_id, (err, serverId) => { @@ -222,7 +222,7 @@ describe('ClsiCookieManager', function() { ) }) - return it('should also set in the secondary if secondary redis is enabled', function(done) { + it('should also set in the secondary if secondary redis is enabled', function(done) { this.redisSecondaryMulti = { set: sinon.stub(), expire: sinon.stub(), @@ -260,7 +260,7 @@ describe('ClsiCookieManager', function() { }) }) - return describe('getCookieJar', function() { + describe('getCookieJar', function() { beforeEach(function() { return (this.ClsiCookieManager._getServerId = sinon .stub() @@ -282,7 +282,7 @@ describe('ClsiCookieManager', function() { ) }) - return it('should return empty cookie jar if clsiCookies are not enabled', function(done) { + it('should return empty cookie jar if clsiCookies are not enabled', function(done) { delete this.settings.clsiCookie.key this.ClsiCookieManager = SandboxedModule.require(modulePath, { requires: this.requires diff --git a/services/web/test/unit/src/Compile/ClsiFormatCheckerTests.js b/services/web/test/unit/src/Compile/ClsiFormatCheckerTests.js index 1020faac2c..ef953641f7 100644 --- a/services/web/test/unit/src/Compile/ClsiFormatCheckerTests.js +++ b/services/web/test/unit/src/Compile/ClsiFormatCheckerTests.js @@ -33,7 +33,7 @@ describe('ClsiFormatChecker', function() { return (this.project_id = 'project-id') }) - return describe('checkRecoursesForProblems', function() { + describe('checkRecoursesForProblems', function() { beforeEach(function() { return (this.resources = [ { @@ -175,7 +175,7 @@ describe('ClsiFormatChecker', function() { ) }) - return it('should not flag up when the file is a substring of a path', function(done) { + it('should not flag up when the file is a substring of a path', function(done) { this.resources.push({ path: 'stuf', content: 'other stuff' @@ -191,7 +191,7 @@ describe('ClsiFormatChecker', function() { }) }) - return describe('_checkDocsAreUnderSizeLimit', function() { + describe('_checkDocsAreUnderSizeLimit', function() { it('should error when there is more than 5mb of data', function(done) { this.resources.push({ path: 'massive.tex', @@ -219,7 +219,7 @@ describe('ClsiFormatChecker', function() { ) }) - return it('should return nothing when project is correct size', function(done) { + it('should return nothing when project is correct size', function(done) { this.resources.push({ path: 'massive.tex', content: require('crypto') diff --git a/services/web/test/unit/src/Compile/ClsiManagerTests.js b/services/web/test/unit/src/Compile/ClsiManagerTests.js index 6e149a42ce..575d49ba47 100644 --- a/services/web/test/unit/src/Compile/ClsiManagerTests.js +++ b/services/web/test/unit/src/Compile/ClsiManagerTests.js @@ -140,7 +140,7 @@ describe('ClsiManager', function() { .should.equal(true) }) - return it('should call the callback with the status and output files', function() { + it('should call the callback with the status and output files', function() { const outputFiles = [ { url: `/project/${this.project_id}/user/${ @@ -180,7 +180,7 @@ describe('ClsiManager', function() { ) }) - return it('should call the callback with a failure status', function() { + it('should call the callback with a failure status', function() { return this.callback.calledWith(null, this.status).should.equal(true) }) }) @@ -218,12 +218,12 @@ describe('ClsiManager', function() { .should.equal(true) }) - return it('should call the callback with a success status', function() { + it('should call the callback with a success status', function() { return this.callback.calledWith(null, this.status).should.equal(true) }) }) - return describe('when the resources fail the precompile check', function() { + describe('when the resources fail the precompile check', function() { beforeEach(function() { this.ClsiFormatChecker.checkRecoursesForProblems = sinon .stub() @@ -245,7 +245,7 @@ describe('ClsiManager', function() { return this.callback.calledOnce.should.equal(true) }) - return it('should call the callback with an error', function() { + it('should call the callback with an error', function() { return this.callback .calledWithExactly(new Error('failed')) .should.equal(true) @@ -299,7 +299,7 @@ describe('ClsiManager', function() { .should.equal(true) }) - return it('should call the callback with the status and output files', function() { + it('should call the callback with the status and output files', function() { const outputFiles = [ { url: `/project/${this.submission_id}/build/1234/output/output.pdf`, @@ -335,12 +335,12 @@ describe('ClsiManager', function() { ) }) - return it('should call the callback with a failure status', function() { + it('should call the callback with a failure status', function() { return this.callback.calledWith(null, this.status).should.equal(true) }) }) - return describe('when the resources fail the precompile check', function() { + describe('when the resources fail the precompile check', function() { beforeEach(function() { this.ClsiFormatChecker.checkRecoursesForProblems = sinon .stub() @@ -362,7 +362,7 @@ describe('ClsiManager', function() { return this.callback.calledOnce.should.equal(true) }) - return it('should call the callback with an error', function() { + it('should call the callback with an error', function() { return this.callback .calledWithExactly(new Error('failed')) .should.equal(true) @@ -378,7 +378,7 @@ describe('ClsiManager', function() { .callsArg(1)) }) - return describe('with the standard compileGroup', function() { + describe('with the standard compileGroup', function() { beforeEach(function() { return this.ClsiManager.deleteAuxFiles( this.project_id, @@ -405,7 +405,7 @@ describe('ClsiManager', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -497,7 +497,7 @@ describe('ClsiManager', function() { .should.equal(true) }) - return it('should build up the CLSI request', function() { + it('should build up the CLSI request', function() { return expect(this.request).to.deep.equal({ compile: { options: { @@ -609,7 +609,7 @@ describe('ClsiManager', function() { }) }) - return describe('when the root doc is set and not in the docupdater', function() { + describe('when the root doc is set and not in the docupdater', function() { beforeEach(function(done) { this.ClsiStateManager.computeHash = sinon .stub() @@ -643,7 +643,7 @@ describe('ClsiManager', function() { ) }) - return it('should still change the root path', function() { + it('should still change the root path', function() { return this.request.compile.rootResourcePath.should.equal( 'chapters/chapter1.tex' ) @@ -663,7 +663,7 @@ describe('ClsiManager', function() { ) }) - return it('should change root path', function() { + it('should change root path', function() { return this.request.compile.rootResourcePath.should.equal( 'chapters/chapter1.tex' ) @@ -682,7 +682,7 @@ describe('ClsiManager', function() { ) }) - return it('should fallback to default root doc', function() { + it('should fallback to default root doc', function() { return this.request.compile.rootResourcePath.should.equal('main.tex') }) }) @@ -700,7 +700,7 @@ describe('ClsiManager', function() { ) }) - return it('should set the compiler to pdflatex', function() { + it('should set the compiler to pdflatex', function() { return this.request.compile.options.compiler.should.equal('pdflatex') }) }) @@ -719,7 +719,7 @@ describe('ClsiManager', function() { ) }) - return it('should set to main.tex', function() { + it('should set to main.tex', function() { return this.request.compile.rootResourcePath.should.equal('main.tex') }) }) @@ -745,7 +745,7 @@ describe('ClsiManager', function() { return this.ClsiManager._buildRequest(this.project, null, this.callback) }) - return it('should report an error', function() { + it('should report an error', function() { return this.callback .calledWith(new Error('no main file specified')) .should.equal(true) @@ -776,12 +776,12 @@ describe('ClsiManager', function() { ) }) - return it('should set io to the only file', function() { + it('should set io to the only file', function() { return this.request.compile.rootResourcePath.should.equal('other.tex') }) }) - return describe('with the draft option', () => + describe('with the draft option', () => it('should add the draft option into the request', function(done) { return this.ClsiManager._buildRequest( this.project_id, @@ -831,12 +831,12 @@ describe('ClsiManager', function() { .should.equal(true) }) - return it('should call the callback with the body and no error', function() { + it('should call the callback with the body and no error', function() { return this.callback.calledWith(null, this.body).should.equal(true) }) }) - return describe('when the CLSI returns an error', function() { + describe('when the CLSI returns an error', function() { beforeEach(function() { this.ClsiManager._makeRequest = sinon .stub() @@ -855,7 +855,7 @@ describe('ClsiManager', function() { ) }) - return it('should call the callback with the body and the error', function() { + it('should call the callback with the body and the error', function() { return this.callback .calledWith( new Error('CLSI returned non-success code: 500'), @@ -908,7 +908,7 @@ describe('ClsiManager', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -924,7 +924,7 @@ describe('ClsiManager', function() { ) }) - return it('should call wordCount with param file', function() { + it('should call wordCount with param file', function() { return this.ClsiManager._makeRequest .calledWith(this.project_id, { method: 'GET', @@ -937,7 +937,7 @@ describe('ClsiManager', function() { }) }) - return describe('with image', function() { + describe('with image', function() { beforeEach(function() { this.req.compile.options.imageName = this.image = 'example.com/mock/image' @@ -950,7 +950,7 @@ describe('ClsiManager', function() { ) }) - return it('should call wordCount with file and image', function() { + it('should call wordCount with file and image', function() { return this.ClsiManager._makeRequest .calledWith(this.project_id, { method: 'GET', @@ -984,7 +984,7 @@ describe('ClsiManager', function() { }) }) - return it('should set the cookie again on response as it might have changed', function(done) { + it('should set the cookie again on response as it might have changed', function(done) { return this.ClsiManager._makeRequest(this.project_id, this.opts, () => { this.ClsiCookieManager.setServerId .calledWith(this.project_id, this.response) @@ -994,7 +994,7 @@ describe('ClsiManager', function() { }) }) - return describe('_makeGoogleCloudRequest', function() { + describe('_makeGoogleCloudRequest', function() { beforeEach(function() { this.settings.apis.clsi_new = { url: 'https://compiles.somewhere.test' } this.response = { there: 'something' } @@ -1018,7 +1018,7 @@ describe('ClsiManager', function() { ) }) - return it('should not make a request if there is not clsi_new url', function(done) { + it('should not make a request if there is not clsi_new url', function(done) { this.settings.apis.clsi_new = undefined return this.ClsiManager._makeNewBackendRequest( this.project_id, diff --git a/services/web/test/unit/src/Compile/ClsiStateManagerTests.js b/services/web/test/unit/src/Compile/ClsiStateManagerTests.js index 6ec7936c79..6409a12d33 100644 --- a/services/web/test/unit/src/Compile/ClsiStateManagerTests.js +++ b/services/web/test/unit/src/Compile/ClsiStateManagerTests.js @@ -37,7 +37,7 @@ describe('ClsiStateManager', function() { return (this.callback = sinon.stub()) }) - return describe('computeHash', function() { + describe('computeHash', function() { beforeEach(function(done) { this.docs = [ { path: '/main.tex', doc: { _id: 'doc-id-1' } }, @@ -75,7 +75,7 @@ describe('ClsiStateManager', function() { ) }) - return it('should call the callback with a hash value', function() { + it('should call the callback with a hash value', function() { return this.callback .calledWith(null, '21b1ab73aa3892bec452baf8ffa0956179e1880f') .should.equal(true) @@ -96,7 +96,7 @@ describe('ClsiStateManager', function() { ) }) - return it('should call the callback with the same hash value', function() { + it('should call the callback with the same hash value', function() { return this.callback.calledWith(null, this.hash0).should.equal(true) }) }) @@ -114,7 +114,7 @@ describe('ClsiStateManager', function() { ) }) - return it('should call the callback with a different hash value', function() { + it('should call the callback with a different hash value', function() { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) @@ -134,7 +134,7 @@ describe('ClsiStateManager', function() { ) }) - return it('should call the callback with a different hash value', function() { + it('should call the callback with a different hash value', function() { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) @@ -154,7 +154,7 @@ describe('ClsiStateManager', function() { ) }) - return it('should call the callback with a different hash value', function() { + it('should call the callback with a different hash value', function() { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) @@ -177,7 +177,7 @@ describe('ClsiStateManager', function() { ) }) - return it('should call the callback with a different hash value', function() { + it('should call the callback with a different hash value', function() { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) @@ -197,7 +197,7 @@ describe('ClsiStateManager', function() { ) }) - return it('should call the callback with a different hash value', function() { + it('should call the callback with a different hash value', function() { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) @@ -217,7 +217,7 @@ describe('ClsiStateManager', function() { ) }) - return it('should call the callback with a different hash value', function() { + it('should call the callback with a different hash value', function() { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) @@ -237,7 +237,7 @@ describe('ClsiStateManager', function() { ) }) - return it('should call the callback with a different hash value', function() { + it('should call the callback with a different hash value', function() { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) @@ -257,7 +257,7 @@ describe('ClsiStateManager', function() { ) }) - return it('should call the callback with a different hash value', function() { + it('should call the callback with a different hash value', function() { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) @@ -277,14 +277,14 @@ describe('ClsiStateManager', function() { ) }) - return it('should call the callback with a different hash value', function() { + it('should call the callback with a different hash value', function() { return this.callback .neverCalledWith(null, this.hash0) .should.equal(true) }) }) - return describe('when the isAutoCompile option is changed', function() { + describe('when the isAutoCompile option is changed', function() { beforeEach(function() { this.options.isAutoCompile = !this.options.isAutoCompile return this.ClsiStateManager.computeHash( @@ -294,7 +294,7 @@ describe('ClsiStateManager', function() { ) }) - return it('should call the callback with the same hash value', function() { + it('should call the callback with the same hash value', function() { return this.callback.calledWith(null, this.hash0).should.equal(true) }) }) diff --git a/services/web/test/unit/src/Compile/CompileControllerTests.js b/services/web/test/unit/src/Compile/CompileControllerTests.js index 3584fa87c4..d63224fac5 100644 --- a/services/web/test/unit/src/Compile/CompileControllerTests.js +++ b/services/web/test/unit/src/Compile/CompileControllerTests.js @@ -122,7 +122,7 @@ describe('CompileController', function() { .should.equal(true) }) - return it('should send a successful response reporting the status and files', function() { + it('should send a successful response reporting the status and files', function() { this.res.statusCode.should.equal(200) return this.res.body.should.equal( JSON.stringify({ @@ -139,20 +139,20 @@ describe('CompileController', function() { return this.CompileController.compile(this.req, this.res, this.next) }) - return it('should do the compile with the auto compile flag', function() { + it('should do the compile with the auto compile flag', function() { return this.CompileManager.compile .calledWith(this.project_id, this.user_id, { isAutoCompile: true }) .should.equal(true) }) }) - return describe('with the draft attribute', function() { + describe('with the draft attribute', function() { beforeEach(function() { this.req.body = { draft: true } return this.CompileController.compile(this.req, this.res, this.next) }) - return it('should do the compile without the draft compile flag', function() { + it('should do the compile without the draft compile flag', function() { return this.CompileManager.compile .calledWith(this.project_id, this.user_id, { isAutoCompile: false, @@ -213,7 +213,7 @@ describe('CompileController', function() { ) }) - return it('should use the supplied values', function() { + it('should use the supplied values', function() { return this.ClsiManager.sendExternalRequest .calledWith( this.submission_id, @@ -224,7 +224,7 @@ describe('CompileController', function() { }) }) - return describe('with other supported options but not compileGroup and timeout', function() { + describe('with other supported options but not compileGroup and timeout', function() { beforeEach(function() { this.req.body = { rootResourcePath: 'main.tex', @@ -239,7 +239,7 @@ describe('CompileController', function() { ) }) - return it('should use the other options but default values for compileGroup and timeout', function() { + it('should use the other options but default values for compileGroup and timeout', function() { return this.ClsiManager.sendExternalRequest .calledWith( this.submission_id, @@ -303,7 +303,7 @@ describe('CompileController', function() { return this.Metrics.inc.calledWith('pdf-downloads').should.equal(true) }) - return it('should proxy the PDF from the CLSI', function() { + it('should proxy the PDF from the CLSI', function() { return this.CompileController.proxyToClsi .calledWith( this.project_id, @@ -326,7 +326,7 @@ describe('CompileController', function() { return this.CompileController.downloadPdf(this.req, this.res, this.next) }) - return it('should proxy the PDF from the CLSI, with a build-id', function() { + it('should proxy the PDF from the CLSI, with a build-id', function() { return this.CompileController.proxyToClsi .calledWith( this.project_id, @@ -341,7 +341,7 @@ describe('CompileController', function() { }) }) - return describe('when the pdf is not going to be used in pdfjs viewer', function() { + describe('when the pdf is not going to be used in pdfjs viewer', function() { it('should check the rate limiter when pdfng is not set', function(done) { this.req.query = {} this.RateLimiter.addCount.callsArgWith(1, null, true) @@ -352,7 +352,7 @@ describe('CompileController', function() { return this.CompileController.downloadPdf(this.req, this.res) }) - return it('should check the rate limiter when pdfng is false', function(done) { + it('should check the rate limiter when pdfng is false', function(done) { this.req.query = { pdfng: false } this.RateLimiter.addCount.callsArgWith(1, null, true) this.CompileController.proxyToClsi = (project_id, url) => { @@ -390,7 +390,7 @@ describe('CompileController', function() { ) }) - return it('should proxy to CLSI with correct URL and default limits', function() { + it('should proxy to CLSI with correct URL and default limits', function() { return this.CompileController.proxyToClsiWithLimits .calledWith(this.submission_id, this.expected_url, { compileGroup: 'standard' @@ -399,7 +399,7 @@ describe('CompileController', function() { }) }) - return describe('with limits specified', function() { + describe('with limits specified', function() { beforeEach(function() { this.req.body = { compileTimeout: 600, compileGroup: 'special' } return this.CompileController.getFileFromClsiWithoutUser( @@ -409,7 +409,7 @@ describe('CompileController', function() { ) }) - return it('should proxy to CLSI with correct URL and specified limits', function() { + it('should proxy to CLSI with correct URL and specified limits', function() { return this.CompileController.proxyToClsiWithLimits .calledWith(this.submission_id, this.expected_url, { compileGroup: 'special' @@ -470,7 +470,7 @@ describe('CompileController', function() { return this.proxy.pipe.calledWith(this.res).should.equal(true) }) - return it('should bind an error handle to the request proxy', function() { + it('should bind an error handle to the request proxy', function() { return this.proxy.on.calledWith('error').should.equal(true) }) }) @@ -516,7 +516,7 @@ describe('CompileController', function() { return this.proxy.pipe.calledWith(this.res).should.equal(true) }) - return it('should bind an error handle to the request proxy', function() { + it('should bind an error handle to the request proxy', function() { return this.proxy.on.calledWith('error').should.equal(true) }) }) @@ -533,7 +533,7 @@ describe('CompileController', function() { ) }) - return it('should proxy to the standard url', function() { + it('should proxy to the standard url', function() { return this.request .calledWith({ jar: this.jar, @@ -545,7 +545,7 @@ describe('CompileController', function() { }) }) - return describe('user with build parameter via query string', function() { + describe('user with build parameter via query string', function() { beforeEach(function() { this.CompileManager.getProjectCompileLimits = sinon .stub() @@ -560,7 +560,7 @@ describe('CompileController', function() { ) }) - return it('should proxy to the standard url without the build parameter', function() { + it('should proxy to the standard url without the build parameter', function() { return this.request .calledWith({ jar: this.jar, @@ -573,7 +573,7 @@ describe('CompileController', function() { }) }) - return describe('new pdf viewer', function() { + describe('new pdf viewer', function() { beforeEach(function() { return (this.req.query = { pdfng: true }) }) @@ -611,12 +611,12 @@ describe('CompileController', function() { return this.proxy.pipe.calledWith(this.res).should.equal(true) }) - return it('should bind an error handle to the request proxy', function() { + it('should bind an error handle to the request proxy', function() { return this.proxy.on.calledWith('error').should.equal(true) }) }) - return describe('user with build parameter via query string', function() { + describe('user with build parameter via query string', function() { beforeEach(function() { this.CompileManager.getProjectCompileLimits = sinon .stub() @@ -631,7 +631,7 @@ describe('CompileController', function() { ) }) - return it('should proxy to the standard url with the build parameter', function() { + it('should proxy to the standard url with the build parameter', function() { return this.request .calledWith({ jar: this.jar, @@ -669,7 +669,7 @@ describe('CompileController', function() { .should.equal(true) }) - return it('should return a 200', function() { + it('should return a 200', function() { return this.res.sendStatus.calledWith(200).should.equal(true) }) }) @@ -692,7 +692,7 @@ describe('CompileController', function() { return done() }) - return it('should proxy the res to the clsi with correct url', function(done) { + it('should proxy the res to the clsi with correct url', function(done) { this.CompileController.compileAndDownloadPdf(this.req, this.res) sinon.assert.calledWith( this.CompileController.proxyToClsi, @@ -714,7 +714,7 @@ describe('CompileController', function() { }) }) - return describe('wordCount', function() { + describe('wordCount', function() { beforeEach(function() { this.CompileManager.wordCount = sinon .stub() @@ -731,7 +731,7 @@ describe('CompileController', function() { .should.equal(true) }) - return it('should return a 200 and body', function() { + it('should return a 200 and body', function() { return this.res.send.calledWith({ content: 'body' }).should.equal(true) }) }) diff --git a/services/web/test/unit/src/Compile/CompileManagerTests.js b/services/web/test/unit/src/Compile/CompileManagerTests.js index 2d95d49055..43e90917b8 100644 --- a/services/web/test/unit/src/Compile/CompileManagerTests.js +++ b/services/web/test/unit/src/Compile/CompileManagerTests.js @@ -140,7 +140,7 @@ describe('CompileManager', function() { return this.Metrics.Timer.prototype.done.called.should.equal(true) }) - return it('should log out the compile', function() { + it('should log out the compile', function() { return this.logger.log .calledWith( { project_id: this.project_id, user_id: this.user_id }, @@ -171,7 +171,7 @@ describe('CompileManager', function() { ) })) - return describe('should check the rate limit', () => + describe('should check the rate limit', () => it('should return', function(done) { this.CompileManager._checkIfAutoCompileLimitHasBeenHit = sinon .stub() @@ -222,7 +222,7 @@ describe('CompileManager', function() { .should.equal(true) }) - return it('should return the limits', function() { + it('should return the limits', function() { return this.callback .calledWith(null, { timeout: this.timeout, @@ -261,7 +261,7 @@ describe('CompileManager', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -289,12 +289,12 @@ describe('CompileManager', function() { .should.equal(true) }) - return it('should call the callback with true', function() { + it('should call the callback with true', function() { return this.callback.calledWith(null, true).should.equal(true) }) }) - return describe('when the key does not exist in redis', function() { + describe('when the key does not exist in redis', function() { beforeEach(function() { this.rclient.set = sinon.stub().callsArgWith(5, null, 'OK') return this.CompileManager._checkIfRecentlyCompiled( @@ -316,7 +316,7 @@ describe('CompileManager', function() { .should.equal(true) }) - return it('should call the callback with false', function() { + it('should call the callback with false', function() { return this.callback.calledWith(null, false).should.equal(true) }) }) @@ -364,7 +364,7 @@ describe('CompileManager', function() { ) }) - return it('should return false if there is an error in the rate limit', function(done) { + it('should return false if there is an error in the rate limit', function(done) { this.ratelimiter.addCount.callsArgWith(1, 'error') return this.CompileManager._checkIfAutoCompileLimitHasBeenHit( true, @@ -377,7 +377,7 @@ describe('CompileManager', function() { }) }) - return describe('wordCount', function() { + describe('wordCount', function() { beforeEach(function() { this.CompileManager.getProjectCompileLimits = sinon .stub() @@ -407,7 +407,7 @@ describe('CompileManager', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) diff --git a/services/web/test/unit/src/Contact/ContactControllerTests.js b/services/web/test/unit/src/Contact/ContactControllerTests.js index af5cc3db5d..8a7165cc27 100644 --- a/services/web/test/unit/src/Contact/ContactControllerTests.js +++ b/services/web/test/unit/src/Contact/ContactControllerTests.js @@ -44,7 +44,7 @@ describe('ContactController', function() { return (this.res.send = sinon.stub()) }) - return describe('getContacts', function() { + describe('getContacts', function() { beforeEach(function() { this.user_id = 'mock-user-id' this.contact_ids = ['contact-1', 'contact-2', 'contact-3'] @@ -115,7 +115,7 @@ describe('ContactController', function() { .should.equal(true) }) - return it('should return a formatted list of contacts in contact list order, without holding accounts', function() { + it('should return a formatted list of contacts in contact list order, without holding accounts', function() { return this.res.send.args[0][0].contacts.should.deep.equal([ { id: 'contact-1', diff --git a/services/web/test/unit/src/Contact/ContactManagerTests.js b/services/web/test/unit/src/Contact/ContactManagerTests.js index da6e7701ef..35b1b27d13 100644 --- a/services/web/test/unit/src/Contact/ContactManagerTests.js +++ b/services/web/test/unit/src/Contact/ContactManagerTests.js @@ -71,14 +71,14 @@ describe('ContactManager', function() { .should.equal(true) }) - return it('should call the callback with the contatcs', function() { + it('should call the callback with the contatcs', function() { return this.callback .calledWith(null, this.contact_ids) .should.equal(true) }) }) - return describe('with a failed response code', function() { + describe('with a failed response code', function() { beforeEach(function() { this.request.get = sinon .stub() @@ -98,7 +98,7 @@ describe('ContactManager', function() { .should.equal(true) }) - return it('should log the error', function() { + it('should log the error', function() { return this.logger.error .calledWith( { @@ -114,7 +114,7 @@ describe('ContactManager', function() { }) }) - return describe('addContact', function() { + describe('addContact', function() { describe('with a successful response code', function() { beforeEach(function() { this.request.post = sinon @@ -141,12 +141,12 @@ describe('ContactManager', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) - return describe('with a failed response code', function() { + describe('with a failed response code', function() { beforeEach(function() { this.request.post = sinon .stub() @@ -166,7 +166,7 @@ describe('ContactManager', function() { .should.equal(true) }) - return it('should log the error', function() { + it('should log the error', function() { return this.logger.error .calledWith( { diff --git a/services/web/test/unit/src/Cooldown/CooldownManagerTests.js b/services/web/test/unit/src/Cooldown/CooldownManagerTests.js index 6abf2102bd..a5c5dcad9c 100644 --- a/services/web/test/unit/src/Cooldown/CooldownManagerTests.js +++ b/services/web/test/unit/src/Cooldown/CooldownManagerTests.js @@ -66,7 +66,7 @@ describe('CooldownManager', function() { }) }) - return it('should produce a true result', function(done) { + it('should produce a true result', function(done) { return this.call((err, result) => { expect(result).to.equal(true) return done() @@ -94,7 +94,7 @@ describe('CooldownManager', function() { }) }) - return it('should produce a false result', function(done) { + it('should produce a false result', function(done) { return this.call((err, result) => { expect(result).to.equal(false) return done() @@ -102,7 +102,7 @@ describe('CooldownManager', function() { }) }) - return describe('when rclient.get produces an error', function() { + describe('when rclient.get produces an error', function() { beforeEach(function() { return (this.rclient.get = sinon .stub() @@ -117,7 +117,7 @@ describe('CooldownManager', function() { }) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, result) => { expect(err).to.not.equal(null) expect(err).to.be.instanceof(Error) @@ -127,7 +127,7 @@ describe('CooldownManager', function() { }) }) - return describe('putProjectOnCooldown', function() { + describe('putProjectOnCooldown', function() { beforeEach(function() { return (this.call = cb => { return this.CooldownManager.putProjectOnCooldown(this.projectId, cb) @@ -147,7 +147,7 @@ describe('CooldownManager', function() { }) }) - return it('should not produce an error', function(done) { + it('should not produce an error', function(done) { return this.call(err => { expect(err).to.equal(null) return done() @@ -155,7 +155,7 @@ describe('CooldownManager', function() { }) }) - return describe('when rclient.set produces an error', function() { + describe('when rclient.set produces an error', function() { beforeEach(function() { return (this.rclient.set = sinon .stub() @@ -170,7 +170,7 @@ describe('CooldownManager', function() { }) }) - return it('produce an error', function(done) { + it('produce an error', function(done) { return this.call(err => { expect(err).to.not.equal(null) expect(err).to.be.instanceof(Error) diff --git a/services/web/test/unit/src/Cooldown/CooldownMiddlewareTests.js b/services/web/test/unit/src/Cooldown/CooldownMiddlewareTests.js index 6f38a2f5ef..381c24e58e 100644 --- a/services/web/test/unit/src/Cooldown/CooldownMiddlewareTests.js +++ b/services/web/test/unit/src/Cooldown/CooldownMiddlewareTests.js @@ -29,7 +29,7 @@ describe('CooldownMiddleware', function() { })) }) - return describe('freezeProject', function() { + describe('freezeProject', function() { describe('when project is on cooldown', function() { beforeEach(function() { this.CooldownManager.isProjectOnCooldown = sinon @@ -53,7 +53,7 @@ describe('CooldownMiddleware', function() { return this.next.callCount.should.equal(0) }) - return it('should send a 429 status', function() { + it('should send a 429 status', function() { this.CooldownMiddleware.freezeProject(this.req, this.res, this.next) this.res.sendStatus.callCount.should.equal(1) return this.res.sendStatus.calledWith(429).should.equal(true) @@ -78,7 +78,7 @@ describe('CooldownMiddleware', function() { .should.equal(true) }) - return it('call next with no arguments', function() { + it('call next with no arguments', function() { this.CooldownMiddleware.freezeProject(this.req, this.res, this.next) this.next.callCount.should.equal(1) return expect(this.next.lastCall.args.length).to.equal(0) @@ -103,14 +103,14 @@ describe('CooldownMiddleware', function() { .should.equal(true) }) - return it('call next with an error', function() { + it('call next with an error', function() { this.CooldownMiddleware.freezeProject(this.req, this.res, this.next) this.next.callCount.should.equal(1) return expect(this.next.lastCall.args[0]).to.be.instanceof(Error) }) }) - return describe('when projectId is not part of route', function() { + describe('when projectId is not part of route', function() { beforeEach(function() { this.CooldownManager.isProjectOnCooldown = sinon .stub() @@ -126,7 +126,7 @@ describe('CooldownMiddleware', function() { return expect(this.next.lastCall.args[0]).to.be.instanceof(Error) }) - return it('should not call CooldownManager.isProjectOnCooldown', function() { + it('should not call CooldownManager.isProjectOnCooldown', function() { this.CooldownMiddleware.freezeProject(this.req, this.res, this.next) return this.CooldownManager.isProjectOnCooldown.callCount.should.equal( 0 diff --git a/services/web/test/unit/src/Docstore/DocstoreManagerTests.js b/services/web/test/unit/src/Docstore/DocstoreManagerTests.js index 385e2f300e..8a2867dc8d 100644 --- a/services/web/test/unit/src/Docstore/DocstoreManagerTests.js +++ b/services/web/test/unit/src/Docstore/DocstoreManagerTests.js @@ -69,7 +69,7 @@ describe('DocstoreManager', function() { .should.equal(true) }) - return it('should call the callback without an error', function() { + it('should call the callback without an error', function() { return this.callback.calledWith(null).should.equal(true) }) }) @@ -94,7 +94,7 @@ describe('DocstoreManager', function() { .should.equal(true) }) - return it('should log the error', function() { + it('should log the error', function() { return this.logger.error .calledWith( { @@ -110,7 +110,7 @@ describe('DocstoreManager', function() { }) }) - return describe('with a missing (404) response code', function() { + describe('with a missing (404) response code', function() { beforeEach(function() { this.request.del = sinon .stub() @@ -130,7 +130,7 @@ describe('DocstoreManager', function() { .should.equal(true) }) - return it('should log the error', function() { + it('should log the error', function() { return this.logger.error .calledWith( { @@ -191,14 +191,14 @@ describe('DocstoreManager', function() { .should.equal(true) }) - return it('should call the callback with the modified status and revision', function() { + it('should call the callback with the modified status and revision', function() { return this.callback .calledWith(null, this.modified, this.rev) .should.equal(true) }) }) - return describe('with a failed response code', function() { + describe('with a failed response code', function() { beforeEach(function() { this.request.post = sinon .stub() @@ -221,7 +221,7 @@ describe('DocstoreManager', function() { .should.equal(true) }) - return it('should log the error', function() { + it('should log the error', function() { return this.logger.error .calledWith( { @@ -271,7 +271,7 @@ describe('DocstoreManager', function() { .should.equal(true) }) - return it('should call the callback with the lines, version and rev', function() { + it('should call the callback with the lines, version and rev', function() { return this.callback .calledWith(null, this.lines, this.rev, this.version, this.ranges) .should.equal(true) @@ -298,7 +298,7 @@ describe('DocstoreManager', function() { .should.equal(true) }) - return it('should log the error', function() { + it('should log the error', function() { return this.logger.error .calledWith( { @@ -338,14 +338,14 @@ describe('DocstoreManager', function() { .should.equal(true) }) - return it('should call the callback with the lines, version and rev', function() { + it('should call the callback with the lines, version and rev', function() { return this.callback .calledWith(null, this.lines, this.rev, this.version, this.ranges) .should.equal(true) }) }) - return describe('with a missing (404) response code', function() { + describe('with a missing (404) response code', function() { beforeEach(function() { this.request.get = sinon .stub() @@ -363,7 +363,7 @@ describe('DocstoreManager', function() { .should.equal(true) }) - return it('should log the error', function() { + it('should log the error', function() { return this.logger.error .calledWith( { @@ -403,12 +403,12 @@ describe('DocstoreManager', function() { .should.equal(true) }) - return it('should call the callback with the docs', function() { + it('should call the callback with the docs', function() { return this.callback.calledWith(null, this.docs).should.equal(true) }) }) - return describe('with a failed response code', function() { + describe('with a failed response code', function() { beforeEach(function() { this.request.get = sinon .stub() @@ -424,7 +424,7 @@ describe('DocstoreManager', function() { .should.equal(true) }) - return it('should log the error', function() { + it('should log the error', function() { return this.logger.error .calledWith( { @@ -465,12 +465,12 @@ describe('DocstoreManager', function() { .should.equal(true) }) - return it('should call the callback with the docs', function() { + it('should call the callback with the docs', function() { return this.callback.calledWith(null, this.docs).should.equal(true) }) }) - return describe('with a failed response code', function() { + describe('with a failed response code', function() { beforeEach(function() { this.request.get = sinon .stub() @@ -486,7 +486,7 @@ describe('DocstoreManager', function() { .should.equal(true) }) - return it('should log the error', function() { + it('should log the error', function() { return this.logger.error .calledWith( { @@ -514,12 +514,12 @@ describe('DocstoreManager', function() { ) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) - return describe('with a failed response code', function() { + describe('with a failed response code', function() { beforeEach(function() { this.request.post = sinon .stub() @@ -530,7 +530,7 @@ describe('DocstoreManager', function() { ) }) - return it('should call the callback with an error', function() { + it('should call the callback with an error', function() { return this.callback .calledWith( new Error('docstore api responded with non-success code: 500') @@ -540,7 +540,7 @@ describe('DocstoreManager', function() { }) }) - return describe('unarchiveProject', function() { + describe('unarchiveProject', function() { describe('with a successful response code', function() { beforeEach(function() { this.request.post = sinon @@ -552,12 +552,12 @@ describe('DocstoreManager', function() { ) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) - return describe('with a failed response code', function() { + describe('with a failed response code', function() { beforeEach(function() { this.request.post = sinon .stub() @@ -568,7 +568,7 @@ describe('DocstoreManager', function() { ) }) - return it('should call the callback with an error', function() { + it('should call the callback with an error', function() { return this.callback .calledWith( new Error('docstore api responded with non-success code: 500') diff --git a/services/web/test/unit/src/DocumentUpdater/DocumentUpdaterHandlerTests.js b/services/web/test/unit/src/DocumentUpdater/DocumentUpdaterHandlerTests.js index 75588a82c9..198159b67d 100644 --- a/services/web/test/unit/src/DocumentUpdater/DocumentUpdaterHandlerTests.js +++ b/services/web/test/unit/src/DocumentUpdater/DocumentUpdaterHandlerTests.js @@ -89,7 +89,7 @@ describe('DocumentUpdaterHandler', function() { .should.equal(true) }) - return it('should call the callback with no error', function() { + it('should call the callback with no error', function() { return this.callback.calledWith(null).should.equal(true) }) }) @@ -105,18 +105,18 @@ describe('DocumentUpdaterHandler', function() { return this.handler.flushProjectToMongo(this.project_id, this.callback) }) - return it('should return an error to the callback', function() { + it('should return an error to the callback', function() { return this.callback.calledWith(this.error).should.equal(true) }) }) - return describe('when the document updater returns a failure error code', function() { + describe('when the document updater returns a failure error code', function() { beforeEach(function() { this.request.callsArgWith(1, null, { statusCode: 500 }, '') return this.handler.flushProjectToMongo(this.project_id, this.callback) }) - return it('should return the callback with an error', function() { + it('should return the callback with an error', function() { return this.callback .calledWith( new Error('doc updater returned failure status code: 500') @@ -147,7 +147,7 @@ describe('DocumentUpdaterHandler', function() { .should.equal(true) }) - return it('should call the callback with no error', function() { + it('should call the callback with no error', function() { return this.callback.calledWith(null).should.equal(true) }) }) @@ -166,12 +166,12 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return an error to the callback', function() { + it('should return an error to the callback', function() { return this.callback.calledWith(this.error).should.equal(true) }) }) - return describe('when the document updater returns a failure error code', function() { + describe('when the document updater returns a failure error code', function() { beforeEach(function() { this.request.callsArgWith(1, null, { statusCode: 500 }, '') return this.handler.flushProjectToMongoAndDelete( @@ -180,7 +180,7 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return the callback with an error', function() { + it('should return the callback with an error', function() { return this.callback .calledWith( new Error('doc updater returned failure status code: 500') @@ -212,7 +212,7 @@ describe('DocumentUpdaterHandler', function() { .should.equal(true) }) - return it('should call the callback with no error', function() { + it('should call the callback with no error', function() { return this.callback.calledWith(null).should.equal(true) }) }) @@ -232,12 +232,12 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return an error to the callback', function() { + it('should return an error to the callback', function() { return this.callback.calledWith(this.error).should.equal(true) }) }) - return describe('when the document updater returns a failure error code', function() { + describe('when the document updater returns a failure error code', function() { beforeEach(function() { this.request.callsArgWith(1, null, { statusCode: 500 }, '') return this.handler.flushDocToMongo( @@ -247,7 +247,7 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return the callback with an error', function() { + it('should return the callback with an error', function() { return this.callback .calledWith( new Error('doc updater returned failure status code: 500') @@ -279,7 +279,7 @@ describe('DocumentUpdaterHandler', function() { .should.equal(true) }) - return it('should call the callback with no error', function() { + it('should call the callback with no error', function() { return this.callback.calledWith(null).should.equal(true) }) }) @@ -299,12 +299,12 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return an error to the callback', function() { + it('should return an error to the callback', function() { return this.callback.calledWith(this.error).should.equal(true) }) }) - return describe('when the document updater returns a failure error code', function() { + describe('when the document updater returns a failure error code', function() { beforeEach(function() { this.request.callsArgWith(1, null, { statusCode: 500 }, '') return this.handler.deleteDoc( @@ -314,7 +314,7 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return the callback with an error', function() { + it('should return the callback with an error', function() { return this.callback .calledWith( new Error('doc updater returned failure status code: 500') @@ -358,7 +358,7 @@ describe('DocumentUpdaterHandler', function() { .should.equal(true) }) - return it('should call the callback with no error', function() { + it('should call the callback with no error', function() { return this.callback.calledWith(null).should.equal(true) }) }) @@ -381,12 +381,12 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return an error to the callback', function() { + it('should return an error to the callback', function() { return this.callback.calledWith(this.error).should.equal(true) }) }) - return describe('when the document updater returns a failure error code', function() { + describe('when the document updater returns a failure error code', function() { beforeEach(function() { this.request.callsArgWith(1, null, { statusCode: 500 }, '') return this.handler.setDocument( @@ -399,7 +399,7 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return the callback with an error', function() { + it('should return the callback with an error', function() { return this.callback .calledWith( new Error('doc updater returned failure status code: 500') @@ -440,7 +440,7 @@ describe('DocumentUpdaterHandler', function() { .should.equal(true) }) - return it('should call the callback with the lines and version', function() { + it('should call the callback with the lines and version', function() { return this.callback .calledWith(null, this.lines, this.version, this.ranges, this.ops) .should.equal(true) @@ -463,12 +463,12 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return an error to the callback', function() { + it('should return an error to the callback', function() { return this.callback.calledWith(this.error).should.equal(true) }) }) - return describe('when the document updater returns a failure error code', function() { + describe('when the document updater returns a failure error code', function() { beforeEach(function() { this.request.callsArgWith(1, null, { statusCode: 500 }, '') return this.handler.getDocument( @@ -479,7 +479,7 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return the callback with an error', function() { + it('should return the callback with an error', function() { return this.callback .calledWith( new Error('doc updater returned failure status code: 500') @@ -520,7 +520,7 @@ describe('DocumentUpdaterHandler', function() { return this.request.post.calledWith(url).should.equal(true) }) - return it('should call the callback with the documents', function() { + it('should call the callback with the documents', function() { return this.callback .calledWithExactly(null, this.docs) .should.equal(true) @@ -544,12 +544,12 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return an error to the callback', function() { + it('should return an error to the callback', function() { return this.callback.calledWith(this.error).should.equal(true) }) }) - return describe('when the document updater returns a conflict error code', function() { + describe('when the document updater returns a conflict error code', function() { beforeEach(function() { this.request.post = sinon .stub() @@ -561,7 +561,7 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return the callback with no documents', function() { + it('should return the callback with no documents', function() { return this.callback.alwaysCalledWithExactly().should.equal(true) }) }) @@ -585,7 +585,7 @@ describe('DocumentUpdaterHandler', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.calledWith(null).should.equal(true) }) }) @@ -601,18 +601,18 @@ describe('DocumentUpdaterHandler', function() { return this.handler.clearProjectState(this.project_id, this.callback) }) - return it('should return an error to the callback', function() { + it('should return an error to the callback', function() { return this.callback.calledWith(this.error).should.equal(true) }) }) - return describe('when the document updater returns an error code', function() { + describe('when the document updater returns an error code', function() { beforeEach(function() { this.request.callsArgWith(1, null, { statusCode: 500 }, null) return this.handler.clearProjectState(this.project_id, this.callback) }) - return it('should return the callback with no documents', function() { + it('should return the callback with no documents', function() { return this.callback .calledWith( new Error('doc updater returned failure status code: 500') @@ -652,7 +652,7 @@ describe('DocumentUpdaterHandler', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.calledWith(null).should.equal(true) }) }) @@ -673,12 +673,12 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return an error to the callback', function() { + it('should return an error to the callback', function() { return this.callback.calledWith(this.error).should.equal(true) }) }) - return describe('when the document updater returns a failure error code', function() { + describe('when the document updater returns a failure error code', function() { beforeEach(function() { this.request.callsArgWith(1, null, { statusCode: 500 }, '') return this.handler.acceptChanges( @@ -689,7 +689,7 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return the callback with an error', function() { + it('should return the callback with an error', function() { return this.callback .calledWith( new Error('doc updater returned failure status code: 500') @@ -726,7 +726,7 @@ describe('DocumentUpdaterHandler', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.calledWith(null).should.equal(true) }) }) @@ -747,12 +747,12 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return an error to the callback', function() { + it('should return an error to the callback', function() { return this.callback.calledWith(this.error).should.equal(true) }) }) - return describe('when the document updater returns a failure error code', function() { + describe('when the document updater returns a failure error code', function() { beforeEach(function() { this.request.callsArgWith(1, null, { statusCode: 500 }, '') return this.handler.deleteThread( @@ -763,7 +763,7 @@ describe('DocumentUpdaterHandler', function() { ) }) - return it('should return the callback with an error', function() { + it('should return the callback with an error', function() { return this.callback .calledWith( new Error('doc updater returned failure status code: 500') @@ -773,7 +773,7 @@ describe('DocumentUpdaterHandler', function() { }) }) - return describe('updateProjectStructure ', function() { + describe('updateProjectStructure ', function() { beforeEach(function() { this.user_id = 1234 return (this.version = 999) @@ -795,12 +795,12 @@ describe('DocumentUpdaterHandler', function() { return this.request.called.should.equal(false) }) - return it('calls the callback', function() { + it('calls the callback', function() { return this.callback.called.should.equal(true) }) }) - return describe('with project history enabled', function() { + describe('with project history enabled', function() { beforeEach(function() { this.settings.apis.project_history.sendProjectStructureOps = true this.url = `${this.settings.apis.documentupdater.url}/project/${ @@ -998,7 +998,7 @@ describe('DocumentUpdaterHandler', function() { ) })) - return describe('when the project version is missing', () => + describe('when the project version is missing', () => it('should call the callback with an error', function() { this.docId = new ObjectId() this.changes = { diff --git a/services/web/test/unit/src/Documents/DocumentControllerTests.js b/services/web/test/unit/src/Documents/DocumentControllerTests.js index bb0219e2a9..5d0a59f50d 100644 --- a/services/web/test/unit/src/Documents/DocumentControllerTests.js +++ b/services/web/test/unit/src/Documents/DocumentControllerTests.js @@ -111,7 +111,7 @@ describe('DocumentController', function() { .should.equal(true) }) - return it('should return the document data to the client as JSON', function() { + it('should return the document data to the client as JSON', function() { this.res.type.should.equal('application/json') return this.res.body.should.equal( JSON.stringify({ @@ -124,7 +124,7 @@ describe('DocumentController', function() { }) }) - return describe("when the document doesn't exist", function() { + describe("when the document doesn't exist", function() { beforeEach(function() { this.ProjectLocator.findElement = sinon .stub() @@ -136,7 +136,7 @@ describe('DocumentController', function() { ) }) - return it('should call next with the NotFoundError', function() { + it('should call next with the NotFoundError', function() { return this.next .calledWith(new Errors.NotFoundError('not found')) .should.equal(true) @@ -175,7 +175,7 @@ describe('DocumentController', function() { ) }) - return it('should return the history id to the client as JSON', function() { + it('should return the history id to the client as JSON', function() { this.res.type.should.equal('application/json') return this.res.body.should.equal( JSON.stringify({ @@ -189,7 +189,7 @@ describe('DocumentController', function() { }) }) - return describe('when the project does not exist', function() { + describe('when the project does not exist', function() { beforeEach(function() { this.ProjectGetter.getProject = sinon.stub().callsArgWith(2, null, null) return this.DocumentController.getDocument( @@ -199,13 +199,13 @@ describe('DocumentController', function() { ) }) - return it('returns a 404', function() { + it('returns a 404', function() { return this.res.statusCode.should.equal(404) }) }) }) - return describe('setDocument', function() { + describe('setDocument', function() { beforeEach(function() { return (this.req.params = { Project_id: this.project_id, @@ -243,12 +243,12 @@ describe('DocumentController', function() { ) }) - return it('should return a successful response', function() { + it('should return a successful response', function() { return this.res.success.should.equal(true) }) }) - return describe("when the document doesn't exist", function() { + describe("when the document doesn't exist", function() { beforeEach(function() { this.ProjectEntityUpdateHandler.updateDocLines = sinon .stub() @@ -261,7 +261,7 @@ describe('DocumentController', function() { ) }) - return it('should call next with the NotFoundError', function() { + it('should call next with the NotFoundError', function() { return this.next .calledWith(new Errors.NotFoundError('not found')) .should.equal(true) diff --git a/services/web/test/unit/src/Documents/DocumentHelperTests.js b/services/web/test/unit/src/Documents/DocumentHelperTests.js index 0be997e918..abe07b9951 100644 --- a/services/web/test/unit/src/Documents/DocumentHelperTests.js +++ b/services/web/test/unit/src/Documents/DocumentHelperTests.js @@ -78,7 +78,7 @@ describe('DocumentHelper', function() { // document = "\\title{Second Year \\large{LaTeX} Exercise}" // expect(@DocumentHelper.getTitleFromTexContent(document)).to.equal "Second Year LaTeX Exercise" - return it('should collapse whitespace', function() { + it('should collapse whitespace', function() { const document = '\\title{Second Year LaTeX Exercise}' return expect( this.DocumentHelper.getTitleFromTexContent(document) @@ -120,14 +120,14 @@ describe('DocumentHelper', function() { ) }) - return it('removes line spacing commands', function() { + it('removes line spacing commands', function() { return expect(this.DocumentHelper.detex('a \\\\[1.50cm] b')).to.equal( 'a b' ) }) }) - return describe('contentHasDocumentclass', function() { + describe('contentHasDocumentclass', function() { it('should return true if the content has a documentclass', function() { const document = ['% line', '% line', '% line', '\\documentclass'] return expect( @@ -154,7 +154,7 @@ describe('DocumentHelper', function() { ).to.equal(false) }) - return it('should return false when there is no documentclass', function() { + it('should return false when there is no documentclass', function() { const document = ['% line', '% line', '% line'] return expect( this.DocumentHelper.contentHasDocumentclass(document) diff --git a/services/web/test/unit/src/Downloads/ProjectDownloadsControllerTests.js b/services/web/test/unit/src/Downloads/ProjectDownloadsControllerTests.js index ea6ab18638..a46a72c261 100644 --- a/services/web/test/unit/src/Downloads/ProjectDownloadsControllerTests.js +++ b/services/web/test/unit/src/Downloads/ProjectDownloadsControllerTests.js @@ -104,14 +104,14 @@ describe('ProjectDownloadsController', function() { return this.metrics.inc.calledWith('zip-downloads').should.equal(true) }) - return it('should log the action', function() { + it('should log the action', function() { return this.logger.log .calledWith(sinon.match.any, 'downloading project') .should.equal(true) }) }) - return describe('downloadMultipleProjects', function() { + describe('downloadMultipleProjects', function() { beforeEach(function() { this.stream = { pipe: sinon.stub() } this.ProjectZipStreamManager.createZipStreamForMultipleProjects = sinon @@ -168,7 +168,7 @@ describe('ProjectDownloadsController', function() { .should.equal(true) }) - return it('should log the action', function() { + it('should log the action', function() { return this.logger.log .calledWith(sinon.match.any, 'downloading multiple projects') .should.equal(true) diff --git a/services/web/test/unit/src/Downloads/ProjectZipStreamManagerTests.js b/services/web/test/unit/src/Downloads/ProjectZipStreamManagerTests.js index 61c4e843cf..f521003a09 100644 --- a/services/web/test/unit/src/Downloads/ProjectZipStreamManagerTests.js +++ b/services/web/test/unit/src/Downloads/ProjectZipStreamManagerTests.js @@ -116,7 +116,7 @@ describe('ProjectZipStreamManager', function() { ) }) - return it('should add all of the projects to the zip', function() { + it('should add all of the projects to the zip', function() { return Array.from(this.project_ids).map(project_id => this.archive.append .calledWith(this.zip_streams[project_id], { @@ -171,7 +171,7 @@ describe('ProjectZipStreamManager', function() { .should.equal(true) }) - return it('should finalise the stream', function() { + it('should finalise the stream', function() { return this.archive.finalize.called.should.equal(true) }) }) @@ -197,7 +197,7 @@ describe('ProjectZipStreamManager', function() { .should.equal(true) }) - return it('should continue with the process', function() { + it('should continue with the process', function() { this.ProjectZipStreamManager.addAllDocsToArchive.called.should.equal( true ) @@ -208,7 +208,7 @@ describe('ProjectZipStreamManager', function() { }) }) - return describe('with an error adding files', function() { + describe('with an error adding files', function() { beforeEach(function() { this.ProjectZipStreamManager.addAllDocsToArchive = sinon .stub() @@ -229,7 +229,7 @@ describe('ProjectZipStreamManager', function() { .should.equal(true) }) - return it('should continue with the process', function() { + it('should continue with the process', function() { this.ProjectZipStreamManager.addAllDocsToArchive.called.should.equal( true ) @@ -275,7 +275,7 @@ describe('ProjectZipStreamManager', function() { .should.equal(true) }) - return it('should add each doc to the archive', function() { + it('should add each doc to the archive', function() { return (() => { const result = [] for (let path in this.docs) { @@ -292,7 +292,7 @@ describe('ProjectZipStreamManager', function() { }) }) - return describe('addAllFilesToArchive', function() { + describe('addAllFilesToArchive', function() { beforeEach(function() { this.files = { '/image.png': { @@ -351,7 +351,7 @@ describe('ProjectZipStreamManager', function() { })() }) - return it('should add each file to the archive', function() { + it('should add each file to the archive', function() { return (() => { const result = [] for (let path in this.files) { diff --git a/services/web/test/unit/src/Editor/EditorControllerTests.js b/services/web/test/unit/src/Editor/EditorControllerTests.js index e7a00119fe..ffb172fbc6 100644 --- a/services/web/test/unit/src/Editor/EditorControllerTests.js +++ b/services/web/test/unit/src/Editor/EditorControllerTests.js @@ -114,7 +114,7 @@ describe('EditorController', function() { .should.equal(true) }) - return it('calls the callback', function() { + it('calls the callback', function() { return this.callback.calledWith(null, this.doc).should.equal(true) }) }) @@ -162,7 +162,7 @@ describe('EditorController', function() { .should.equal(true) }) - return it('calls the callback', function() { + it('calls the callback', function() { return this.callback.calledWith(null, this.file).should.equal(true) }) }) @@ -199,7 +199,7 @@ describe('EditorController', function() { return this.callback.calledWith(null, this.doc).should.equal(true) }) - return describe('doc does not exist', function() { + describe('doc does not exist', function() { beforeEach(function() { this.ProjectEntityUpdateHandler.upsertDoc = sinon .stub() @@ -215,7 +215,7 @@ describe('EditorController', function() { ) }) - return it('sends an update out to users in the project', function() { + it('sends an update out to users in the project', function() { return this.EditorRealTimeController.emitToRoom .calledWith( this.project_id, @@ -263,7 +263,7 @@ describe('EditorController', function() { return this.callback.calledWith(null, this.newFile).should.equal(true) }) - return describe('file does not exist', function() { + describe('file does not exist', function() { beforeEach(function() { this.ProjectEntityUpdateHandler.upsertFile = sinon .stub() @@ -280,7 +280,7 @@ describe('EditorController', function() { ) }) - return it('should send the update out to users in the project', function() { + it('should send the update out to users in the project', function() { return this.EditorRealTimeController.emitToRoom .calledWith( this.project_id, @@ -333,7 +333,7 @@ describe('EditorController', function() { ) }) - return it('should send the update for the doc out to users in the project', function() { + it('should send the update for the doc out to users in the project', function() { return this.EditorRealTimeController.emitToRoom .calledWith( this.project_id, @@ -346,7 +346,7 @@ describe('EditorController', function() { }) }) - return describe('folders required for doc do not exist', function() { + describe('folders required for doc do not exist', function() { beforeEach(function() { const folders = [ (this.folderA = { _id: 2, parentFolder_id: 1 }), @@ -365,7 +365,7 @@ describe('EditorController', function() { ) }) - return it('should send the update for each folder to users in the project', function() { + it('should send the update for each folder to users in the project', function() { this.EditorRealTimeController.emitToRoom .calledWith( this.project_id, @@ -431,7 +431,7 @@ describe('EditorController', function() { ) }) - return it('should send the update for the file out to users in the project', function() { + it('should send the update for the file out to users in the project', function() { return this.EditorRealTimeController.emitToRoom .calledWith( this.project_id, @@ -445,7 +445,7 @@ describe('EditorController', function() { }) }) - return describe('folders required for file do not exist', function() { + describe('folders required for file do not exist', function() { beforeEach(function() { const folders = [ (this.folderA = { _id: 2, parentFolder_id: 1 }), @@ -465,7 +465,7 @@ describe('EditorController', function() { ) }) - return it('should send the update for each folder to users in the project', function() { + it('should send the update for each folder to users in the project', function() { this.EditorRealTimeController.emitToRoom .calledWith( this.project_id, @@ -517,7 +517,7 @@ describe('EditorController', function() { ) }) - return it('should return the folder in the callback', function() { + it('should return the folder in the callback', function() { return this.callback.calledWith(null, this.folder).should.equal(true) }) }) @@ -555,7 +555,7 @@ describe('EditorController', function() { ) }) - return it('should return the folder in the callback', function() { + it('should return the folder in the callback', function() { return this.callback .calledWith(null, this.folders, this.folder) .should.equal(true) @@ -586,7 +586,7 @@ describe('EditorController', function() { ).should.equal.true }) - return it('notify users an entity has been deleted', function() { + it('notify users an entity has been deleted', function() { return this.EditorRealTimeController.emitToRoom .calledWith( this.project_id, @@ -622,7 +622,7 @@ describe('EditorController', function() { ).should.equal.true }) - return it('notify users an entity has been deleted', function() { + it('notify users an entity has been deleted', function() { return this.EditorRealTimeController.emitToRoom .calledWith( this.project_id, @@ -666,7 +666,7 @@ describe('EditorController', function() { .should.equal(true) }) - return it('should notify the other clients about the updated description', function() { + it('should notify the other clients about the updated description', function() { return this.EditorRealTimeController.emitToRoom .calledWith( this.project_id, @@ -685,7 +685,7 @@ describe('EditorController', function() { .callsArgWith(1, this.err)) }) - return it('should call the project handler', function(done) { + it('should call the project handler', function(done) { return this.EditorController.deleteProject(this.project_id, err => { err.should.equal(this.err) this.ProjectDeleter.deleteProject @@ -725,7 +725,7 @@ describe('EditorController', function() { .should.equal(true) }) - return it('should emit the update to the room', function() { + it('should emit the update to the room', function() { return this.EditorRealTimeController.emitToRoom .calledWith( this.project_id, @@ -775,7 +775,7 @@ describe('EditorController', function() { .should.equal(true) }) - return it('calls the callback', function() { + it('calls the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -797,7 +797,7 @@ describe('EditorController', function() { .should.equal(true) }) - return it('should emit the update to the room', function() { + it('should emit the update to the room', function() { return this.EditorRealTimeController.emitToRoom .calledWith(this.project_id, 'projectNameUpdated', this.newName) .should.equal(true) @@ -814,7 +814,7 @@ describe('EditorController', function() { ) }) - return it('should send the new compiler and project id to the project options handler', function() { + it('should send the new compiler and project id to the project options handler', function() { this.ProjectOptionsHandler.setCompiler .calledWith(this.project_id, this.compiler) .should.equal(true) @@ -834,7 +834,7 @@ describe('EditorController', function() { ) }) - return it('should send the new imageName and project id to the project options handler', function() { + it('should send the new imageName and project id to the project options handler', function() { this.ProjectOptionsHandler.setImageName .calledWith(this.project_id, this.imageName) .should.equal(true) @@ -854,7 +854,7 @@ describe('EditorController', function() { ) }) - return it('should send the new languageCode and project id to the project options handler', function() { + it('should send the new languageCode and project id to the project options handler', function() { this.ProjectOptionsHandler.setSpellCheckLanguage .calledWith(this.project_id, this.languageCode) .should.equal(true) @@ -900,7 +900,7 @@ describe('EditorController', function() { .should.equal(false) }) - return it('should not broadcast a token change', function() { + it('should not broadcast a token change', function() { return this.EditorRealTimeController.emitToRoom .calledWith(this.project_id, 'project:tokens:changed', { tokens: this.tokens @@ -909,7 +909,7 @@ describe('EditorController', function() { }) }) - return describe('when setting to tokenBased', function() { + describe('when setting to tokenBased', function() { beforeEach(function() { this.newAccessLevel = 'tokenBased' this.tokens = { readOnly: 'aaa', readAndWrite: '42bbb' } @@ -941,7 +941,7 @@ describe('EditorController', function() { .should.equal(true) }) - return it('should broadcast the token change too', function() { + it('should broadcast the token change too', function() { return this.EditorRealTimeController.emitToRoom .calledWith(this.project_id, 'project:tokens:changed', { tokens: this.tokens @@ -951,7 +951,7 @@ describe('EditorController', function() { }) }) - return describe('setRootDoc', function() { + describe('setRootDoc', function() { beforeEach(function() { this.newRootDocID = '21312321321' this.ProjectEntityUpdateHandler.setRootDoc = sinon.stub().yields() @@ -968,7 +968,7 @@ describe('EditorController', function() { .should.equal(true) }) - return it('should emit the update to the room', function() { + it('should emit the update to the room', function() { return this.EditorRealTimeController.emitToRoom .calledWith(this.project_id, 'rootDocUpdated', this.newRootDocID) .should.equal(true) diff --git a/services/web/test/unit/src/Editor/EditorHttpControllerTests.js b/services/web/test/unit/src/Editor/EditorHttpControllerTests.js index a4cf2ad59b..03f589f123 100644 --- a/services/web/test/unit/src/Editor/EditorHttpControllerTests.js +++ b/services/web/test/unit/src/Editor/EditorHttpControllerTests.js @@ -101,7 +101,7 @@ describe('EditorHttpController', function() { ) }) - return it('should send an inc metric', function() { + it('should send an inc metric', function() { return this.Metrics.inc .calledWith('editor.join-project') .should.equal(true) @@ -114,20 +114,20 @@ describe('EditorHttpController', function() { return this.EditorHttpController.joinProject(this.req, this.res) }) - return it('should unmark the project as deleted', function() { + it('should unmark the project as deleted', function() { return this.ProjectDeleter.unmarkAsDeletedByExternalSource .calledWith(this.project_id) .should.equal(true) }) }) - return describe('with an anonymous user', function() { + describe('with an anonymous user', function() { beforeEach(function() { this.req.query = { user_id: 'anonymous-user' } return this.EditorHttpController.joinProject(this.req, this.res) }) - return it('should pass the user id as null', function() { + it('should pass the user id as null', function() { return this.EditorHttpController._buildJoinProjectView .calledWith(this.req, this.project_id, null) .should.equal(true) @@ -223,14 +223,14 @@ describe('EditorHttpController', function() { .should.equal(true) }) - return it('should return the project model view, privilege level and protocol version', function() { + it('should return the project model view, privilege level and protocol version', function() { return this.callback .calledWith(null, this.projectModelView, 'owner') .should.equal(true) }) }) - return describe('when not authorized', function() { + describe('when not authorized', function() { beforeEach(function() { this.AuthorizationManager.getPrivilegeLevelForProject = sinon .stub() @@ -243,7 +243,7 @@ describe('EditorHttpController', function() { ) }) - return it('should return false in the callback', function() { + it('should return false in the callback', function() { return this.callback.calledWith(null, null, false).should.equal(true) }) }) @@ -280,18 +280,18 @@ describe('EditorHttpController', function() { .should.equal(true) }) - return it('should send the doc back as JSON', function() { + it('should send the doc back as JSON', function() { return this.res.json.calledWith(this.doc).should.equal(true) }) }) - return describe('unsuccesfully', function() { + describe('unsuccesfully', function() { beforeEach(function() { this.req.body.name = '' return this.EditorHttpController.addDoc(this.req, this.res) }) - return it('should send back a bad request status code', function() { + it('should send back a bad request status code', function() { return this.res.sendStatus.calledWith(400).should.equal(true) }) }) @@ -326,18 +326,18 @@ describe('EditorHttpController', function() { .should.equal(true) }) - return it('should send the folder back as JSON', function() { + it('should send the folder back as JSON', function() { return this.res.json.calledWith(this.folder).should.equal(true) }) }) - return describe('unsuccesfully', function() { + describe('unsuccesfully', function() { beforeEach(function() { this.req.body.name = '' return this.EditorHttpController.addFolder(this.req, this.res) }) - return it('should send back a bad request status code', function() { + it('should send back a bad request status code', function() { return this.res.sendStatus.calledWith(400).should.equal(true) }) }) @@ -367,7 +367,7 @@ describe('EditorHttpController', function() { .should.equal(true) }) - return it('should send back a success response', function() { + it('should send back a success response', function() { return this.res.sendStatus.calledWith(204).should.equal(true) }) }) @@ -387,7 +387,7 @@ describe('EditorHttpController', function() { return this.EditorHttpController.renameEntity(this.req, this.res) }) - return it('should send back a bad request status code', function() { + it('should send back a bad request status code', function() { return this.res.sendStatus.calledWith(400).should.equal(true) }) }) @@ -404,7 +404,7 @@ describe('EditorHttpController', function() { return this.EditorHttpController.renameEntity(this.req, this.res) }) - return it('should send back a bad request status code', function() { + it('should send back a bad request status code', function() { return this.res.sendStatus.calledWith(400).should.equal(true) }) }) @@ -433,12 +433,12 @@ describe('EditorHttpController', function() { .should.equal(true) }) - return it('should send back a success response', function() { + it('should send back a success response', function() { return this.res.sendStatus.calledWith(204).should.equal(true) }) }) - return describe('deleteEntity', function() { + describe('deleteEntity', function() { beforeEach(function() { this.req.params = { Project_id: this.project_id, @@ -461,7 +461,7 @@ describe('EditorHttpController', function() { .should.equal(true) }) - return it('should send back a success response', function() { + it('should send back a success response', function() { return this.res.sendStatus.calledWith(204).should.equal(true) }) }) diff --git a/services/web/test/unit/src/Editor/EditorRealTimeControllerTests.js b/services/web/test/unit/src/Editor/EditorRealTimeControllerTests.js index b214ca1627..7beeaaf81e 100644 --- a/services/web/test/unit/src/Editor/EditorRealTimeControllerTests.js +++ b/services/web/test/unit/src/Editor/EditorRealTimeControllerTests.js @@ -55,7 +55,7 @@ describe('EditorRealTimeController', function() { ) }) - return it('should publish the message to redis', function() { + it('should publish the message to redis', function() { return this.rclient.publish .calledWith( 'editor-events', @@ -70,7 +70,7 @@ describe('EditorRealTimeController', function() { }) }) - return describe('emitToAll', function() { + describe('emitToAll', function() { beforeEach(function() { this.EditorRealTimeController.emitToRoom = sinon.stub() return this.EditorRealTimeController.emitToAll( @@ -79,7 +79,7 @@ describe('EditorRealTimeController', function() { ) }) - return it("should emit to the room 'all'", function() { + it("should emit to the room 'all'", function() { return this.EditorRealTimeController.emitToRoom .calledWith('all', this.message, ...Array.from(this.payload)) .should.equal(true) diff --git a/services/web/test/unit/src/Email/EmailBuilderTests.js b/services/web/test/unit/src/Email/EmailBuilderTests.js index ae6f9a08ef..b3172e684c 100644 --- a/services/web/test/unit/src/Email/EmailBuilderTests.js +++ b/services/web/test/unit/src/Email/EmailBuilderTests.js @@ -69,13 +69,13 @@ describe('EmailBuilder', function() { return expect(this.email.text != null).to.equal(true) }) - return it('should not have undefined in it', function() { + it('should not have undefined in it', function() { this.email.html.indexOf('undefined').should.equal(-1) return this.email.subject.indexOf('undefined').should.equal(-1) }) }) - return describe('when someone is up to no good', function() { + describe('when someone is up to no good', function() { beforeEach(function() { this.opts.project.name = "" return (this.email = this.EmailBuilder.buildEmail( @@ -88,14 +88,14 @@ describe('EmailBuilder', function() { return expect(this.email.html).to.contain('New Project') }) - return it('should not have undefined in it', function() { + it('should not have undefined in it', function() { this.email.html.indexOf('undefined').should.equal(-1) return this.email.subject.indexOf('undefined').should.equal(-1) }) }) }) - return describe('SpamSafe', function() { + describe('SpamSafe', function() { beforeEach(function() { this.opts = { to: 'bob@joe.com', @@ -115,7 +115,7 @@ describe('EmailBuilder', function() { )) }) - return it('should replace spammy project name', function() { + it('should replace spammy project name', function() { this.email.html.indexOf('a new project').should.not.equal(-1) return this.email.subject.indexOf('New Project').should.not.equal(-1) }) diff --git a/services/web/test/unit/src/Email/EmailHandlerTests.js b/services/web/test/unit/src/Email/EmailHandlerTests.js index c131a9cd37..bc31e68911 100644 --- a/services/web/test/unit/src/Email/EmailHandlerTests.js +++ b/services/web/test/unit/src/Email/EmailHandlerTests.js @@ -40,7 +40,7 @@ describe('EmailHandler', function() { return (this.html = 'hello') }) - return describe('send email', function() { + describe('send email', function() { it('should use the correct options', function(done) { this.EmailBuilder.buildEmail.returns({ html: this.html }) this.EmailSender.sendEmail.callsArgWith(1) @@ -98,12 +98,12 @@ describe('EmailHandler', function() { }) }) - return describe('with plain-text email content', function() { + describe('with plain-text email content', function() { beforeEach(function() { return (this.text = 'hello there') }) - return it('should pass along the text field', function(done) { + it('should pass along the text field', function(done) { this.EmailBuilder.buildEmail.returns({ html: this.html, text: this.text diff --git a/services/web/test/unit/src/Email/EmailSenderTests.js b/services/web/test/unit/src/Email/EmailSenderTests.js index 04bed5f4ca..dc8f2f6e08 100644 --- a/services/web/test/unit/src/Email/EmailSenderTests.js +++ b/services/web/test/unit/src/Email/EmailSenderTests.js @@ -66,7 +66,7 @@ describe('EmailSender', function() { }) }) - return describe('sendEmail', function() { + describe('sendEmail', function() { it('should set the properties on the email to send', function(done) { this.sesClient.sendMail.callsArgWith(1) @@ -148,12 +148,12 @@ describe('EmailSender', function() { }) }) - return describe('with plain-text email content', function() { + describe('with plain-text email content', function() { beforeEach(function() { return (this.opts.text = 'hello there') }) - return it('should set the text property on the email to send', function(done) { + it('should set the text property on the email to send', function(done) { this.sesClient.sendMail.callsArgWith(1) return this.sender.sendEmail(this.opts, () => { diff --git a/services/web/test/unit/src/Exports/ExportsControllerTests.js b/services/web/test/unit/src/Exports/ExportsControllerTests.js index 11fbd6943c..b04d3efe8f 100644 --- a/services/web/test/unit/src/Exports/ExportsControllerTests.js +++ b/services/web/test/unit/src/Exports/ExportsControllerTests.js @@ -106,7 +106,7 @@ describe('ExportsController', function() { return (this.req.body.showSource = true) }) - return it('should ask the handler to perform the export', function(done) { + it('should ask the handler to perform the export', function(done) { this.handler.exportProject = sinon .stub() .yields(null, { iAmAnExport: true, v1_id: 897 }) @@ -144,7 +144,7 @@ describe('ExportsController', function() { return done() })) - return it('should ask the handler to return the status of an export', function(done) { + it('should ask the handler to return the status of an export', function(done) { this.handler.fetchExport = sinon.stub().yields( null, `{ \ diff --git a/services/web/test/unit/src/Exports/ExportsHandlerTests.js b/services/web/test/unit/src/Exports/ExportsHandlerTests.js index 7a764577b9..a78b677f3f 100644 --- a/services/web/test/unit/src/Exports/ExportsHandlerTests.js +++ b/services/web/test/unit/src/Exports/ExportsHandlerTests.js @@ -98,7 +98,7 @@ describe('ExportsHandler', function() { .should.equal(true) }) - return it('should return the export', function() { + it('should return the export', function() { return this.callback .calledWith(null, this.export_data) .should.equal(true) @@ -119,12 +119,12 @@ describe('ExportsHandler', function() { ) }) - return it('should return an error', function() { + it('should return an error', function() { return (this.callback.args[0][0] instanceof Error).should.equal(true) }) }) - return describe('when export request returns an error to forward to the user', function() { + describe('when export request returns an error to forward to the user', function() { beforeEach(function(done) { this.error_json = { status: 422, message: 'nope' } this.ExportsHandler._requestExport = sinon @@ -139,7 +139,7 @@ describe('ExportsHandler', function() { ) }) - return it('should return success and the response to forward', function() { + it('should return success and the response to forward', function() { ;(this.callback.args[0][0] instanceof Error).should.equal(false) return this.callback.calledWith(null, { forwardResponse: this.error_json @@ -211,7 +211,7 @@ describe('ExportsHandler', function() { return this.ExportsHandler._requestVersion.called.should.equal(true) }) - return it('should return export data', function() { + it('should return export data', function() { const expected_export_data = { project: { id: this.project_id, @@ -265,7 +265,7 @@ describe('ExportsHandler', function() { ) }) - return it('should send the data from the user input', function() { + it('should send the data from the user input', function() { const expected_export_data = { project: { id: this.project_id, @@ -318,7 +318,7 @@ describe('ExportsHandler', function() { ) }) - return it('should return an error', function() { + it('should return an error', function() { return (this.callback.args[0][0] instanceof Error).should.equal(true) }) }) @@ -345,7 +345,7 @@ describe('ExportsHandler', function() { ) }) - return it('should return export data', function() { + it('should return export data', function() { const expected_export_data = { project: { id: this.project_id, @@ -407,7 +407,7 @@ describe('ExportsHandler', function() { ) }) - return it('should return export data', function() { + it('should return export data', function() { const expected_export_data = { project: { id: this.project_id, @@ -446,7 +446,7 @@ describe('ExportsHandler', function() { }) }) - return describe('when no root doc can be identified', function() { + describe('when no root doc can be identified', function() { beforeEach(function(done) { this.ProjectLocator.findRootDoc = sinon .stub() @@ -460,7 +460,7 @@ describe('ExportsHandler', function() { ) }) - return it('should return an error', function() { + it('should return an error', function() { return (this.callback.args[0][0] instanceof Error).should.equal(true) }) }) @@ -480,12 +480,12 @@ describe('ExportsHandler', function() { ) }) - return it('should return an error', function() { + it('should return an error', function() { return (this.callback.args[0][0] instanceof Error).should.equal(true) }) }) - return describe('when project history request fails', function() { + describe('when project history request fails', function() { beforeEach(function(done) { this.ExportsHandler._requestVersion = sinon .stub() @@ -499,7 +499,7 @@ describe('ExportsHandler', function() { ) }) - return it('should return an error', function() { + it('should return an error', function() { return (this.callback.args[0][0] instanceof Error).should.equal(true) }) }) @@ -545,7 +545,7 @@ describe('ExportsHandler', function() { }) }) - return it('should return the v1 export id', function() { + it('should return the v1 export id', function() { return this.callback.calledWith(null, this.export_id).should.equal(true) }) }) @@ -564,12 +564,12 @@ describe('ExportsHandler', function() { ) }) - return it('should return an error', function() { + it('should return an error', function() { return (this.callback.args[0][0] instanceof Error).should.equal(true) }) }) - return describe('when the request returns an error response to forward', function() { + describe('when the request returns an error response to forward', function() { beforeEach(function(done) { this.error_code = 422 this.error_json = { status: this.error_code, message: 'nope' } @@ -585,7 +585,7 @@ describe('ExportsHandler', function() { ) }) - return it('should return success and the response to forward', function() { + it('should return success and the response to forward', function() { ;(this.callback.args[0][0] instanceof Error).should.equal(false) return this.callback.calledWith(null, { forwardResponse: this.error_json @@ -611,7 +611,7 @@ describe('ExportsHandler', function() { return done() }) - return describe('when all goes well', function() { + describe('when all goes well', function() { beforeEach(function(done) { this.stubRequest.get = this.stubGet return this.ExportsHandler.fetchExport( @@ -636,7 +636,7 @@ describe('ExportsHandler', function() { }) }) - return it('should return the v1 export id', function() { + it('should return the v1 export id', function() { return this.callback .calledWith(null, { body: this.body }) .should.equal(true) @@ -644,7 +644,7 @@ describe('ExportsHandler', function() { }) }) - return describe('fetchDownload', function() { + describe('fetchDownload', function() { beforeEach(function(done) { this.settings.apis = { v1: { @@ -662,7 +662,7 @@ describe('ExportsHandler', function() { return done() }) - return describe('when all goes well', function() { + describe('when all goes well', function() { beforeEach(function(done) { this.stubRequest.get = this.stubGet return this.ExportsHandler.fetchDownload( @@ -689,7 +689,7 @@ describe('ExportsHandler', function() { }) }) - return it('should return the v1 export id', function() { + it('should return the v1 export id', function() { return this.callback .calledWith(null, { body: this.body }) .should.equal(true) diff --git a/services/web/test/unit/src/History/HistoryControllerTests.js b/services/web/test/unit/src/History/HistoryControllerTests.js index c611605741..b27bfac5cc 100644 --- a/services/web/test/unit/src/History/HistoryControllerTests.js +++ b/services/web/test/unit/src/History/HistoryControllerTests.js @@ -74,12 +74,12 @@ describe('HistoryController', function() { ) }) - return it('should set the flag for project history to true', function() { + it('should set the flag for project history to true', function() { return this.req.useProjectHistory.should.equal(true) }) }) - return describe('for any other project ', function() { + describe('for any other project ', function() { beforeEach(function() { this.ProjectDetailsHandler.getDetails = sinon .stub() @@ -91,7 +91,7 @@ describe('HistoryController', function() { ) }) - return it('should not set the flag for project history to false', function() { + it('should not set the flag for project history to false', function() { return this.req.useProjectHistory.should.equal(false) }) }) @@ -140,7 +140,7 @@ describe('HistoryController', function() { .should.equal(true) }) - return it('should pipe the response to the client', function() { + it('should pipe the response to the client', function() { return this.proxy.pipe.calledWith(this.res).should.equal(true) }) }) @@ -173,12 +173,12 @@ describe('HistoryController', function() { .should.equal(true) }) - return it('should pipe the response to the client', function() { + it('should pipe the response to the client', function() { return this.proxy.pipe.calledWith(this.res).should.equal(true) }) }) - return describe('with an error', function() { + describe('with an error', function() { beforeEach(function() { this.HistoryController.proxyToHistoryApi(this.req, this.res, this.next) return this.proxy.events['error'].call( @@ -187,7 +187,7 @@ describe('HistoryController', function() { ) }) - return it('should pass the error up the call chain', function() { + it('should pass the error up the call chain', function() { return this.next.calledWith(this.error).should.equal(true) }) }) @@ -239,12 +239,12 @@ describe('HistoryController', function() { .should.equal(true) }) - return it('should return the data with users to the client', function() { + it('should return the data with users to the client', function() { return this.res.json.calledWith(this.data_with_users).should.equal(true) }) }) - return describe('for a project without the project history flag', function() { + describe('for a project without the project history flag', function() { beforeEach(function() { this.req.useProjectHistory = false return this.HistoryController.proxyToHistoryApiAndInjectUserDetails( @@ -279,7 +279,7 @@ describe('HistoryController', function() { .should.equal(true) }) - return it('should return the data with users to the client', function() { + it('should return the data with users to the client', function() { return this.res.json.calledWith(this.data_with_users).should.equal(true) }) }) @@ -307,12 +307,12 @@ describe('HistoryController', function() { .should.equal(false) }) - return it('should not return the data with users to the client', function() { + it('should not return the data with users to the client', function() { return this.res.json.calledWith(this.data_with_users).should.equal(false) }) }) - return describe('resyncProjectHistory', function() { + describe('resyncProjectHistory', function() { describe('for a project without project-history enabled', function() { beforeEach(function() { this.project_id = 'mock-project-id' @@ -332,12 +332,12 @@ describe('HistoryController', function() { ) }) - return it('response with a 404', function() { + it('response with a 404', function() { return this.res.sendStatus.calledWith(404).should.equal(true) }) }) - return describe('for a project with project-history enabled', function() { + describe('for a project with project-history enabled', function() { beforeEach(function() { this.project_id = 'mock-project-id' this.req = { params: { Project_id: this.project_id } } @@ -361,7 +361,7 @@ describe('HistoryController', function() { .should.equal(true) }) - return it('responds with a 204', function() { + it('responds with a 204', function() { return this.res.sendStatus.calledWith(204).should.equal(true) }) }) diff --git a/services/web/test/unit/src/History/HistoryManagerTests.js b/services/web/test/unit/src/History/HistoryManagerTests.js index 8a26d7a1dc..dc481eba64 100644 --- a/services/web/test/unit/src/History/HistoryManagerTests.js +++ b/services/web/test/unit/src/History/HistoryManagerTests.js @@ -67,7 +67,7 @@ describe('HistoryManager', function() { .should.equal(true) }) - return it('should return the callback with the overleaf id', function() { + it('should return the callback with the overleaf id', function() { return this.callback .calledWithExactly(null, { overleaf_id: this.overleaf_id }) .should.equal(true) @@ -85,7 +85,7 @@ describe('HistoryManager', function() { return this.HistoryManager.initializeProject(this.callback) }) - return it('should return the callback with an error', function() { + it('should return the callback with an error', function() { return this.callback .calledWith( sinon.match.has( @@ -105,7 +105,7 @@ describe('HistoryManager', function() { return this.HistoryManager.initializeProject(this.callback) }) - return it('should return the callback with an error', function() { + it('should return the callback with an error', function() { return this.callback .calledWith( sinon.match.has( @@ -117,7 +117,7 @@ describe('HistoryManager', function() { }) }) - return describe('project history errors', function() { + describe('project history errors', function() { beforeEach(function() { this.error = sinon.stub() this.request.post = sinon.stub().callsArgWith(1, this.error) @@ -125,25 +125,25 @@ describe('HistoryManager', function() { return this.HistoryManager.initializeProject(this.callback) }) - return it('should return the callback with the error', function() { + it('should return the callback with the error', function() { return this.callback.calledWithExactly(this.error).should.equal(true) }) }) }) - return describe('with project history disabled', function() { + describe('with project history disabled', function() { beforeEach(function() { this.settings.apis.project_history.initializeHistoryForNewProjects = false return this.HistoryManager.initializeProject(this.callback) }) - return it('should return the callback', function() { + it('should return the callback', function() { return this.callback.calledWithExactly().should.equal(true) }) }) }) - return describe('injectUserDetails', function() { + describe('injectUserDetails', function() { beforeEach(function() { this.user1 = { _id: (this.user_id1 = '123456'), @@ -202,7 +202,7 @@ describe('HistoryManager', function() { ) }) - return it('should leave user objects', function(done) { + it('should leave user objects', function(done) { return this.HistoryManager.injectUserDetails( { diff: [ @@ -230,7 +230,7 @@ describe('HistoryManager', function() { }) }) - return describe('with a list of updates', function() { + describe('with a list of updates', function() { it('should turn user_ids into user objects', function(done) { return this.HistoryManager.injectUserDetails( { @@ -264,7 +264,7 @@ describe('HistoryManager', function() { ) }) - return it('should leave user objects', function(done) { + it('should leave user objects', function(done) { return this.HistoryManager.injectUserDetails( { updates: [ diff --git a/services/web/test/unit/src/History/RestoreManagerTests.js b/services/web/test/unit/src/History/RestoreManagerTests.js index 80bdf244d6..36c56db8ad 100644 --- a/services/web/test/unit/src/History/RestoreManagerTests.js +++ b/services/web/test/unit/src/History/RestoreManagerTests.js @@ -98,12 +98,12 @@ describe('RestoreManager', function() { .should.equal(true) }) - return it('should call the callback with the entity', function() { + it('should call the callback with the entity', function() { return this.callback.calledWith(null, this.entity).should.equal(true) }) }) - return describe('with a file in a folder', function() { + describe('with a file in a folder', function() { beforeEach(function() { this.pathname = 'foo/bar.tex' return this.RestoreManager.restoreFileFromV2( @@ -121,7 +121,7 @@ describe('RestoreManager', function() { .should.equal(true) }) - return it('should add the entity by its basename', function() { + it('should add the entity by its basename', function() { return this.FileSystemImportManager.addEntity .calledWith( this.user_id, @@ -154,12 +154,12 @@ describe('RestoreManager', function() { .should.equal(true) }) - return it('should return the folder_id', function() { + it('should return the folder_id', function() { return this.callback.calledWith(null, this.folder_id).should.equal(true) }) }) - return describe('_addEntityWithUniqueName', function() { + describe('_addEntityWithUniqueName', function() { beforeEach(function() { this.addEntityWithName = sinon.stub() return (this.name = 'foo.tex') @@ -179,12 +179,12 @@ describe('RestoreManager', function() { return this.addEntityWithName.calledWith(this.name).should.equal(true) }) - return it('should return the entity', function() { + it('should return the entity', function() { return this.callback.calledWith(null, this.entity).should.equal(true) }) }) - return describe('with an invalid name', function() { + describe('with an invalid name', function() { beforeEach(function() { this.addEntityWithName .onFirstCall() @@ -210,7 +210,7 @@ describe('RestoreManager', function() { .should.equal(true) }) - return it('should return the entity', function() { + it('should return the entity', function() { return this.callback.calledWith(null, this.entity).should.equal(true) }) }) diff --git a/services/web/test/unit/src/InactiveData/InactiveProjectManagerTests.js b/services/web/test/unit/src/InactiveData/InactiveProjectManagerTests.js index c7a0e13b61..8a73608057 100644 --- a/services/web/test/unit/src/InactiveData/InactiveProjectManagerTests.js +++ b/services/web/test/unit/src/InactiveData/InactiveProjectManagerTests.js @@ -92,7 +92,7 @@ describe('InactiveProjectManager', function() { ) }) - return it('should not call unarchiveProject if it is active', function(done) { + it('should not call unarchiveProject if it is active', function(done) { this.project.active = true this.DocstoreManager.unarchiveProject.callsArgWith(1) return this.InactiveProjectManager.reactivateProjectIfRequired( @@ -110,7 +110,7 @@ describe('InactiveProjectManager', function() { }) }) - return describe('deactivateProject', function() { + describe('deactivateProject', function() { it('should call unarchiveProject and markAsInactive', function(done) { this.DocstoreManager.archiveProject.callsArgWith(1) this.TrackChangesManager.archiveProject.callsArgWith(1) @@ -132,7 +132,7 @@ describe('InactiveProjectManager', function() { ) }) - return it('should not call markAsInactive if there was a problem archiving in docstore', function(done) { + it('should not call markAsInactive if there was a problem archiving in docstore', function(done) { this.DocstoreManager.archiveProject.callsArgWith(1, 'errorrr') this.TrackChangesManager.archiveProject.callsArgWith(1) diff --git a/services/web/test/unit/src/Institutions/InstitutionsAPITests.js b/services/web/test/unit/src/Institutions/InstitutionsAPITests.js index f146e55771..41e96f7cdd 100644 --- a/services/web/test/unit/src/Institutions/InstitutionsAPITests.js +++ b/services/web/test/unit/src/Institutions/InstitutionsAPITests.js @@ -75,7 +75,7 @@ describe('InstitutionsAPI', function() { ) }) - return it('handle empty response', function(done) { + it('handle empty response', function(done) { this.settings.apis = null return this.InstitutionsAPI.getInstitutionAffiliations( this.institutionId, @@ -158,7 +158,7 @@ describe('InstitutionsAPI', function() { ) }) - return it('handle empty response', function(done) { + it('handle empty response', function(done) { this.settings.apis = null return this.InstitutionsAPI.getUserAffiliations( this.stubbedUser._id, @@ -211,7 +211,7 @@ describe('InstitutionsAPI', function() { ) }) - return it('handle error', function(done) { + it('handle error', function(done) { const body = { errors: 'affiliation error message' } this.request.callsArgWith(1, null, { statusCode: 422 }, body) return this.InstitutionsAPI.addAffiliation( @@ -252,7 +252,7 @@ describe('InstitutionsAPI', function() { ) }) - return it('handle error', function(done) { + it('handle error', function(done) { this.request.callsArgWith(1, null, { statusCode: 500 }) return this.InstitutionsAPI.removeAffiliation( this.stubbedUser._id, @@ -285,7 +285,7 @@ describe('InstitutionsAPI', function() { ) }) - return it('handle error', function(done) { + it('handle error', function(done) { const body = { errors: 'affiliation error message' } this.request.callsArgWith(1, null, { statusCode: 518 }, body) return this.InstitutionsAPI.deleteAffiliations( @@ -300,12 +300,12 @@ describe('InstitutionsAPI', function() { }) }) - return describe('endorseAffiliation', function() { + describe('endorseAffiliation', function() { beforeEach(function() { return this.request.callsArgWith(1, null, { statusCode: 204 }) }) - return it('endorse affiliation', function(done) { + it('endorse affiliation', function(done) { return this.InstitutionsAPI.endorseAffiliation( this.stubbedUser._id, this.newEmail, diff --git a/services/web/test/unit/src/Institutions/InstitutionsControllerTests.js b/services/web/test/unit/src/Institutions/InstitutionsControllerTests.js index 808b28167b..133a7526a3 100644 --- a/services/web/test/unit/src/Institutions/InstitutionsControllerTests.js +++ b/services/web/test/unit/src/Institutions/InstitutionsControllerTests.js @@ -74,7 +74,7 @@ describe('InstitutionsController', function() { return (this.next = sinon.stub()) }) - return describe('affiliateUsers', function() { + describe('affiliateUsers', function() { it('should add affiliations for matching users', function(done) { this.res.sendStatus = code => { code.should.equal(200) @@ -104,7 +104,7 @@ describe('InstitutionsController', function() { ) }) - return it('should return errors if last affiliation cannot be added', function(done) { + it('should return errors if last affiliation cannot be added', function(done) { this.addAffiliation.onCall(2).callsArgWith(3, new Error('error')) this.next = error => { expect(error).to.exist diff --git a/services/web/test/unit/src/Institutions/InstitutionsFeaturesTests.js b/services/web/test/unit/src/Institutions/InstitutionsFeaturesTests.js index 8e77b59e2a..dbbf9fb24a 100644 --- a/services/web/test/unit/src/Institutions/InstitutionsFeaturesTests.js +++ b/services/web/test/unit/src/Institutions/InstitutionsFeaturesTests.js @@ -86,7 +86,7 @@ describe('InstitutionsFeatures', function() { }) }) - return it('should return true if user has confirmed paid affiliation', function(done) { + it('should return true if user has confirmed paid affiliation', function(done) { const institutions = [ { licence: 'pro_plus' }, { licence: 'free' }, @@ -140,7 +140,7 @@ describe('InstitutionsFeatures', function() { ) }) - return it('should return feaures if user has affiliations plan code', function(done) { + it('should return feaures if user has affiliations plan code', function(done) { this.InstitutionsFeatures.getInstitutionsPlan.yields( null, this.institutionPlanCode @@ -156,7 +156,7 @@ describe('InstitutionsFeatures', function() { }) }) - return describe('getInstitutionsPlan', function() { + describe('getInstitutionsPlan', function() { beforeEach(function() { return (this.InstitutionsFeatures.hasLicence = sinon.stub()) }) @@ -184,7 +184,7 @@ describe('InstitutionsFeatures', function() { ) }) - return it('should return plan if user has licence', function(done) { + it('should return plan if user has licence', function(done) { this.InstitutionsFeatures.hasLicence.yields(null, true) return this.InstitutionsFeatures.getInstitutionsPlan( this.userId, diff --git a/services/web/test/unit/src/Institutions/InstitutionsGetterTests.js b/services/web/test/unit/src/Institutions/InstitutionsGetterTests.js index 2aa5530659..f2bd0a8227 100644 --- a/services/web/test/unit/src/Institutions/InstitutionsGetterTests.js +++ b/services/web/test/unit/src/Institutions/InstitutionsGetterTests.js @@ -38,7 +38,7 @@ describe('InstitutionsGetter', function() { return (this.userId = '12345abcde') }) - return describe('getConfirmedInstitutions', function() { + describe('getConfirmedInstitutions', function() { it('filters unconfirmed affiliations', function(done) { this.userEmails = [ { @@ -80,7 +80,7 @@ describe('InstitutionsGetter', function() { ) }) - return it('should handle error', function(done) { + it('should handle error', function(done) { this.UserGetter.getUserFullEmails.yields(new Error('Nope')) return this.InstitutionsGetter.getConfirmedInstitutions( this.userId, diff --git a/services/web/test/unit/src/Institutions/InstitutionsManagerTests.js b/services/web/test/unit/src/Institutions/InstitutionsManagerTests.js index 43d4fd4986..9f1db35fed 100644 --- a/services/web/test/unit/src/Institutions/InstitutionsManagerTests.js +++ b/services/web/test/unit/src/Institutions/InstitutionsManagerTests.js @@ -135,7 +135,7 @@ describe('InstitutionsManager', function() { ) }) - return it('notifies users if they have a subscription that should be cancelled', function(done) { + it('notifies users if they have a subscription that should be cancelled', function(done) { return this.InstitutionsManager.upgradeInstitutionUsers( this.institutionId, error => { @@ -189,7 +189,7 @@ describe('InstitutionsManager', function() { ) })) - return describe('getInstitutionUsersSubscriptions', () => + describe('getInstitutionUsersSubscriptions', () => it('returns all institution users subscriptions', function(done) { const stubbedUsers = [ { user_id: '123abc123abc123abc123abc' }, diff --git a/services/web/test/unit/src/Metadata/MetaControllerTests.js b/services/web/test/unit/src/Metadata/MetaControllerTests.js index f70e88a65b..73c40d6a59 100644 --- a/services/web/test/unit/src/Metadata/MetaControllerTests.js +++ b/services/web/test/unit/src/Metadata/MetaControllerTests.js @@ -68,7 +68,7 @@ describe('MetaController', function() { ]) }) - return describe('when MetaHandler.getAllMetaForProject produces an error', function() { + describe('when MetaHandler.getAllMetaForProject produces an error', function() { beforeEach(function() { this.MetaHandler.getAllMetaForProject = sinon .stub() @@ -92,14 +92,14 @@ describe('MetaController', function() { return expect(this.next.lastCall.args[0]).to.be.instanceof(Error) }) - return it('should not send a json response', function() { + it('should not send a json response', function() { this.MetadataController.getMetadata(this.req, this.res, this.next) return this.res.json.callCount.should.equal(0) }) }) }) - return describe('broadcastMetadataForDoc', function() { + describe('broadcastMetadataForDoc', function() { beforeEach(function() { this.MetaHandler.getMetaForDoc = sinon .stub() @@ -155,7 +155,7 @@ describe('MetaController', function() { return expect(lastCall.args[2]).to.have.all.keys(['docId', 'meta']) }) - return describe('when MetaHandler.getMetaForDoc produces an error', function() { + describe('when MetaHandler.getMetaForDoc produces an error', function() { beforeEach(function() { this.MetaHandler.getMetaForDoc = sinon .stub() @@ -191,7 +191,7 @@ describe('MetaController', function() { return expect(this.next.lastCall.args[0]).to.be.instanceof(Error) }) - return it('should not send a json response', function() { + it('should not send a json response', function() { this.MetadataController.broadcastMetadataForDoc( this.req, this.res, diff --git a/services/web/test/unit/src/Metadata/MetaHandlerTests.js b/services/web/test/unit/src/Metadata/MetaHandlerTests.js index 3db28a26d0..b0937bb7a9 100644 --- a/services/web/test/unit/src/Metadata/MetaHandlerTests.js +++ b/services/web/test/unit/src/Metadata/MetaHandlerTests.js @@ -77,7 +77,7 @@ describe('MetaHandler', function() { ]) }) - return it('should extract all the labels and packages', function() { + it('should extract all the labels and packages', function() { const docMeta = this.MetaHandler.extractMetaFromDoc(this.lines) return expect(docMeta).to.deep.equal({ labels: ['aaa', 'bbb'], @@ -137,7 +137,7 @@ describe('MetaHandler', function() { }) }) - return it('should extract all metadata', function() { + it('should extract all metadata', function() { const projectMeta = this.MetaHandler.extractMetaFromProjectDocs(this.docs) return expect(projectMeta).to.deep.equal({ id_one: { labels: ['aaa'], packages: {} }, @@ -241,7 +241,7 @@ describe('MetaHandler', function() { }) }) - return it('should call extractMetaFromDoc', function(done) { + it('should call extractMetaFromDoc', function(done) { return this.call((err, docMeta) => { this.MetaHandler.extractMetaFromDoc.callCount.should.equal(1) this.MetaHandler.extractMetaFromDoc @@ -252,7 +252,7 @@ describe('MetaHandler', function() { }) }) - return describe('getAllMetaForProject', function() { + describe('getAllMetaForProject', function() { beforeEach(function() { this.fakeDocs = { doc_one: { @@ -317,7 +317,7 @@ describe('MetaHandler', function() { }) }) - return it('should call extractMetaFromDoc', function(done) { + it('should call extractMetaFromDoc', function(done) { return this.call((err, docMeta) => { this.MetaHandler.extractMetaFromProjectDocs.callCount.should.equal(1) this.MetaHandler.extractMetaFromProjectDocs diff --git a/services/web/test/unit/src/Notifications/NotificationsBuilderTests.js b/services/web/test/unit/src/Notifications/NotificationsBuilderTests.js index 92fb45fde1..6aa84affa4 100644 --- a/services/web/test/unit/src/Notifications/NotificationsBuilderTests.js +++ b/services/web/test/unit/src/Notifications/NotificationsBuilderTests.js @@ -46,7 +46,7 @@ describe('NotificationsBuilder', function() { })) }) - return it('should call v1 and create affiliation notifications', function(done) { + it('should call v1 and create affiliation notifications', function(done) { const ip = '192.168.0.1' return this.controller .ipMatcherAffiliation(user_id) diff --git a/services/web/test/unit/src/Notifications/NotificationsControllerTests.js b/services/web/test/unit/src/Notifications/NotificationsControllerTests.js index a289a54814..9038b21357 100644 --- a/services/web/test/unit/src/Notifications/NotificationsControllerTests.js +++ b/services/web/test/unit/src/Notifications/NotificationsControllerTests.js @@ -77,7 +77,7 @@ describe('NotificationsController', function() { }) }) - return it('should send a delete request when a delete has been received to mark a notification', function(done) { + it('should send a delete request when a delete has been received to mark a notification', function(done) { return this.controller.markNotificationAsRead(this.req, { send: () => { this.handler.markAsRead diff --git a/services/web/test/unit/src/Notifications/NotificationsHandlerTests.js b/services/web/test/unit/src/Notifications/NotificationsHandlerTests.js index 80d0570ccd..771e60da41 100644 --- a/services/web/test/unit/src/Notifications/NotificationsHandlerTests.js +++ b/services/web/test/unit/src/Notifications/NotificationsHandlerTests.js @@ -68,7 +68,7 @@ describe('NotificationsHandler', function() { ) }) - return it('should return empty arrays if there are no notifications', function() { + it('should return empty arrays if there are no notifications', function() { this.request.callsArgWith(1, null, { statusCode: 200 }, null) return this.handler.getUserNotifications( user_id, @@ -84,7 +84,7 @@ describe('NotificationsHandler', function() { return (this.key = 'some key here') }) - return it('should send a delete request when a delete has been received to mark a notification', function(done) { + it('should send a delete request when a delete has been received to mark a notification', function(done) { return this.handler.markAsReadWithKey(user_id, this.key, () => { const opts = { uri: `${notificationUrl}/user/${user_id}`, @@ -131,7 +131,7 @@ describe('NotificationsHandler', function() { ) }) - return describe('when expiry date is supplied', function() { + describe('when expiry date is supplied', function() { beforeEach(function() { this.key = 'some key here' this.messageOpts = { value: 12344 } @@ -139,7 +139,7 @@ describe('NotificationsHandler', function() { return (this.expiry = new Date()) }) - return it('should post the message over with expiry field', function(done) { + it('should post the message over with expiry field', function(done) { return this.handler.createNotification( user_id, this.key, @@ -165,12 +165,12 @@ describe('NotificationsHandler', function() { }) }) - return describe('markAsReadByKeyOnly', function() { + describe('markAsReadByKeyOnly', function() { beforeEach(function() { return (this.key = 'some key here') }) - return it('should send a delete request when a delete has been received to mark a notification', function(done) { + it('should send a delete request when a delete has been received to mark a notification', function(done) { return this.handler.markAsReadByKeyOnly(this.key, () => { const opts = { uri: `${notificationUrl}/key/${this.key}`, diff --git a/services/web/test/unit/src/PasswordReset/PasswordResetControllerTests.js b/services/web/test/unit/src/PasswordReset/PasswordResetControllerTests.js index 17999a4353..7dd8515785 100644 --- a/services/web/test/unit/src/PasswordReset/PasswordResetControllerTests.js +++ b/services/web/test/unit/src/PasswordReset/PasswordResetControllerTests.js @@ -150,7 +150,7 @@ describe('PasswordResetController', function() { return this.PasswordResetController.requestReset(this.req, this.res) }) - return it('should lowercase the email address', function(done) { + it('should lowercase the email address', function(done) { this.email = 'UPerCaseEMAIL@example.Com' this.req.body.email = this.email this.RateLimiter.addCount.callsArgWith(1, null, true) @@ -285,7 +285,7 @@ describe('PasswordResetController', function() { return this.PasswordResetController.setNewUserPassword(this.req, this.res) }) - return describe('when login_after is set', function() { + describe('when login_after is set', function() { beforeEach(function() { this.UserGetter.getUser = sinon .stub() @@ -306,7 +306,7 @@ describe('PasswordResetController', function() { .returns('/some/path')) }) - return it('should login user if login_after is set', function(done) { + it('should login user if login_after is set', function(done) { this.PasswordResetController.setNewUserPassword(this.req, this.res) this.AuthenticationController.afterLoginSessionSetup.callCount.should.equal( 1 @@ -324,13 +324,13 @@ describe('PasswordResetController', function() { }) }) - return describe('renderSetPasswordForm', function() { + describe('renderSetPasswordForm', function() { describe('with token in query-string', function() { beforeEach(function() { return (this.req.query.passwordResetToken = this.token) }) - return it('should set session.resetToken and redirect', function(done) { + it('should set session.resetToken and redirect', function(done) { this.req.session.should.not.have.property('resetToken') this.res.redirect = path => { path.should.equal('/user/password/set') @@ -344,13 +344,13 @@ describe('PasswordResetController', function() { }) }) - return describe('without a token in query-string', function() { + describe('without a token in query-string', function() { describe('with token in session', function() { beforeEach(function() { return (this.req.session.resetToken = this.token) }) - return it('should render the page, passing the reset token', function(done) { + it('should render the page, passing the reset token', function(done) { this.res.render = (template_path, options) => { options.passwordResetToken.should.equal(this.req.session.resetToken) return done() @@ -362,7 +362,7 @@ describe('PasswordResetController', function() { }) }) - return describe('without a token in session', () => + describe('without a token in session', () => it('should redirect to the reset request page', function(done) { this.res.redirect = path => { path.should.equal('/user/password/reset') diff --git a/services/web/test/unit/src/PasswordReset/PasswordResetHandlerTests.js b/services/web/test/unit/src/PasswordReset/PasswordResetHandlerTests.js index f264a630df..a12f6021f9 100644 --- a/services/web/test/unit/src/PasswordReset/PasswordResetHandlerTests.js +++ b/services/web/test/unit/src/PasswordReset/PasswordResetHandlerTests.js @@ -98,7 +98,7 @@ describe('PasswordResetHandler', function() { ) }) - return it('should return exists == null for a holdingAccount', function(done) { + it('should return exists == null for a holdingAccount', function(done) { this.user.holdingAccount = true this.UserGetter.getUserByMainEmail.callsArgWith(1, null, this.user) this.UserGetter.getUserByAnyEmail.callsArgWith(1) @@ -113,7 +113,7 @@ describe('PasswordResetHandler', function() { }) }) - return describe('when in overleaf', function() { + describe('when in overleaf', function() { beforeEach(function() { return (this.settings.overleaf = true) }) @@ -160,7 +160,7 @@ describe('PasswordResetHandler', function() { ) }) - return it('should return status == true', function() { + it('should return status == true', function() { return this.callback.calledWith(null, 'primary').should.equal(true) }) }) @@ -185,7 +185,7 @@ describe('PasswordResetHandler', function() { return this.EmailHandler.sendEmail.called.should.equal(false) }) - return it('should return status == null', function() { + it('should return status == null', function() { return this.callback.calledWith(null, null).should.equal(true) }) }) @@ -210,12 +210,12 @@ describe('PasswordResetHandler', function() { return this.EmailHandler.sendEmail.called.should.equal(false) }) - return it('should return status == sharelatex', function() { + it('should return status == sharelatex', function() { return this.callback.calledWith(null, 'sharelatex').should.equal(true) }) }) - return describe('when the email is a secondary email', function() { + describe('when the email is a secondary email', function() { beforeEach(function() { this.V1Api.request = sinon .stub() @@ -236,14 +236,14 @@ describe('PasswordResetHandler', function() { return this.EmailHandler.sendEmail.called.should.equal(false) }) - return it('should return status == secondary', function() { + it('should return status == secondary', function() { return this.callback.calledWith(null, 'secondary').should.equal(true) }) }) }) }) - return describe('setNewUserPassword', function() { + describe('setNewUserPassword', function() { describe('when no data is found', function() { beforeEach(function() { this.OneTimeTokenHandler.getValueFromTokenAndExpire.yields(null, null) @@ -254,7 +254,7 @@ describe('PasswordResetHandler', function() { ) }) - return it('should return exists == false', function() { + it('should return exists == false', function() { return this.callback.calledWith(null, false).should.equal(true) }) }) @@ -283,14 +283,14 @@ describe('PasswordResetHandler', function() { .should.equal(true) }) - return it('should reset == true and the user_id', function() { + it('should reset == true and the user_id', function() { return this.callback .calledWith(null, true, this.user_id) .should.equal(true) }) }) - return describe('when the data is a new style user_id', function() { + describe('when the data is a new style user_id', function() { beforeEach(function() { this.AuthenticationManager.setUserPassword.yields( null, @@ -313,7 +313,7 @@ describe('PasswordResetHandler', function() { .should.equal(true) }) - return it('should reset == true and the user_id', function() { + it('should reset == true and the user_id', function() { return this.callback .calledWith(null, true, this.user_id) .should.equal(true) diff --git a/services/web/test/unit/src/Project/DocLinesComparitorTests.js b/services/web/test/unit/src/Project/DocLinesComparitorTests.js index f3a18dbbd3..a652442a8a 100644 --- a/services/web/test/unit/src/Project/DocLinesComparitorTests.js +++ b/services/web/test/unit/src/Project/DocLinesComparitorTests.js @@ -89,7 +89,7 @@ describe('doc lines comparitor', function() { return result.should.equal(true) }) - return it('should return false when comparing different orchard docs', function() { + it('should return false when comparing different orchard docs', function() { const lines1 = [{ text: 'goodbye world' }] const lines2 = [{ text: 'hello world' }] const result = this.comparitor.areSame(lines1, lines2) diff --git a/services/web/test/unit/src/Project/ProjectApiControllerTests.js b/services/web/test/unit/src/Project/ProjectApiControllerTests.js index 5c7bda1c57..1dc89b0ace 100644 --- a/services/web/test/unit/src/Project/ProjectApiControllerTests.js +++ b/services/web/test/unit/src/Project/ProjectApiControllerTests.js @@ -41,7 +41,7 @@ describe('Project api controller', function() { return (this.projDetails = { name: 'something' }) }) - return describe('getProjectDetails', function() { + describe('getProjectDetails', function() { it('should ask the project details handler for proj details', function(done) { this.ProjectDetailsHandler.getDetails.callsArgWith( 1, @@ -58,7 +58,7 @@ describe('Project api controller', function() { return this.controller.getProjectDetails(this.req, this.res) }) - return it('should send a 500 if there is an error', function() { + it('should send a 500 if there is an error', function() { this.ProjectDetailsHandler.getDetails.callsArgWith(1, 'error') this.controller.getProjectDetails(this.req, this.res, this.next) return this.next.calledWith('error').should.equal(true) diff --git a/services/web/test/unit/src/Project/ProjectCollabratecDetailsTest.js b/services/web/test/unit/src/Project/ProjectCollabratecDetailsTest.js index f01e1c0d2e..59586a4ac2 100644 --- a/services/web/test/unit/src/Project/ProjectCollabratecDetailsTest.js +++ b/services/web/test/unit/src/Project/ProjectCollabratecDetailsTest.js @@ -55,7 +55,7 @@ describe('ProjectCollabratecDetailsHandler', function() { ) }) - return it('should update project model', function() { + it('should update project model', function() { const update = { $set: { collabratecUsers: [ @@ -87,12 +87,12 @@ describe('ProjectCollabratecDetailsHandler', function() { ) }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback).to.have.been.calledWith('error') }) }) - return describe('with invalid args', function() { + describe('with invalid args', function() { beforeEach(function() { this.ProjectModel.update = sinon.stub() return this.ProjectCollabratecDetailsHandler.initializeCollabratecProject( @@ -108,7 +108,7 @@ describe('ProjectCollabratecDetailsHandler', function() { return expect(this.ProjectModel.update).not.to.have.beenCalled }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback.firstCall.args[0]).to.be.instanceOf(Error) }) }) @@ -143,12 +143,12 @@ describe('ProjectCollabratecDetailsHandler', function() { ) }) - return it('should callback with true', function() { + it('should callback with true', function() { return expect(this.callback).to.have.been.calledWith(null, true) }) }) - return describe('when user project found', function() { + describe('when user project found', function() { beforeEach(function() { this.ProjectModel.findOne = sinon.stub().yields(null, null) return this.ProjectCollabratecDetailsHandler.isLinkedCollabratecUserProject( @@ -158,7 +158,7 @@ describe('ProjectCollabratecDetailsHandler', function() { ) }) - return it('should callback with false', function() { + it('should callback with false', function() { return expect(this.callback).to.have.been.calledWith(null, false) }) }) @@ -174,12 +174,12 @@ describe('ProjectCollabratecDetailsHandler', function() { ) }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback).to.have.been.calledWith('error') }) }) - return describe('with invalid args', function() { + describe('with invalid args', function() { beforeEach(function() { this.ProjectModel.findOne = sinon.stub() return this.ProjectCollabratecDetailsHandler.isLinkedCollabratecUserProject( @@ -193,7 +193,7 @@ describe('ProjectCollabratecDetailsHandler', function() { return expect(this.ProjectModel.findOne).not.to.have.beenCalled }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback.firstCall.args[0]).to.be.instanceOf(Error) }) }) @@ -211,7 +211,7 @@ describe('ProjectCollabratecDetailsHandler', function() { ) }) - return it('should update project model', function() { + it('should update project model', function() { const query = { _id: this.projectId, collabratecUsers: { @@ -250,12 +250,12 @@ describe('ProjectCollabratecDetailsHandler', function() { ) }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback).to.have.been.calledWith('error') }) }) - return describe('with invalid args', function() { + describe('with invalid args', function() { beforeEach(function() { this.ProjectModel.update = sinon.stub() return this.ProjectCollabratecDetailsHandler.linkCollabratecUserProject( @@ -270,7 +270,7 @@ describe('ProjectCollabratecDetailsHandler', function() { return expect(this.ProjectModel.update).not.to.have.beenCalled }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback.firstCall.args[0]).to.be.instanceOf(Error) }) }) @@ -302,7 +302,7 @@ describe('ProjectCollabratecDetailsHandler', function() { ) }) - return it('should update project model', function() { + it('should update project model', function() { const update = { $set: { collabratecUsers: this.collabratecUsers @@ -326,7 +326,7 @@ describe('ProjectCollabratecDetailsHandler', function() { ) }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback).to.have.been.calledWith('error') }) }) @@ -345,12 +345,12 @@ describe('ProjectCollabratecDetailsHandler', function() { return expect(this.ProjectModel.update).not.to.have.beenCalled }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback.firstCall.args[0]).to.be.instanceOf(Error) }) }) - return describe('with invalid user_id', function() { + describe('with invalid user_id', function() { beforeEach(function() { this.collabratecUsers[1].user_id = 'bad-user-id' this.ProjectModel.update = sinon.stub() @@ -365,7 +365,7 @@ describe('ProjectCollabratecDetailsHandler', function() { return expect(this.ProjectModel.update).not.to.have.beenCalled }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback.firstCall.args[0]).to.be.instanceOf(Error) }) }) @@ -382,7 +382,7 @@ describe('ProjectCollabratecDetailsHandler', function() { ) }) - return it('should update project model', function() { + it('should update project model', function() { const query = { _id: this.projectId } const update = { $pull: { @@ -409,12 +409,12 @@ describe('ProjectCollabratecDetailsHandler', function() { ) }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback).to.have.been.calledWith('error') }) }) - return describe('with invalid args', function() { + describe('with invalid args', function() { beforeEach(function() { this.ProjectModel.update = sinon.stub() return this.ProjectCollabratecDetailsHandler.unlinkCollabratecUserProject( @@ -428,13 +428,13 @@ describe('ProjectCollabratecDetailsHandler', function() { return expect(this.ProjectModel.update).not.to.have.beenCalled }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback.firstCall.args[0]).to.be.instanceOf(Error) }) }) }) - return describe('updateCollabratecUserIds', function() { + describe('updateCollabratecUserIds', function() { describe('when update succeeds', function() { beforeEach(function() { this.ProjectModel.update = sinon.stub().yields() @@ -445,7 +445,7 @@ describe('ProjectCollabratecDetailsHandler', function() { ) }) - return it('should update project model', function() { + it('should update project model', function() { return expect(this.ProjectModel.update).to.have.been.calledWith( { 'collabratecUsers.user_id': this.userId }, { $set: { 'collabratecUsers.$.user_id': this.userId2 } }, @@ -465,7 +465,7 @@ describe('ProjectCollabratecDetailsHandler', function() { ) }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback).to.have.been.calledWith('error') }) }) @@ -484,12 +484,12 @@ describe('ProjectCollabratecDetailsHandler', function() { return expect(this.ProjectModel.update).not.to.have.beenCalled }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback.firstCall.args[0]).to.be.instanceOf(Error) }) }) - return describe('with invalid new_user_id', function() { + describe('with invalid new_user_id', function() { beforeEach(function() { this.ProjectModel.update = sinon.stub() return this.ProjectCollabratecDetailsHandler.updateCollabratecUserIds( @@ -503,7 +503,7 @@ describe('ProjectCollabratecDetailsHandler', function() { return expect(this.ProjectModel.update).not.to.have.beenCalled }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback.firstCall.args[0]).to.be.instanceOf(Error) }) }) diff --git a/services/web/test/unit/src/Project/ProjectControllerTests.js b/services/web/test/unit/src/Project/ProjectControllerTests.js index e66bedc747..2cbab29960 100644 --- a/services/web/test/unit/src/Project/ProjectControllerTests.js +++ b/services/web/test/unit/src/Project/ProjectControllerTests.js @@ -246,7 +246,7 @@ describe('ProjectController', function() { return this.ProjectController.updateProjectSettings(this.req, this.res) }) - return it('should update the root doc', function(done) { + it('should update the root doc', function(done) { this.EditorController.setRootDoc = sinon.stub().callsArg(2) this.req.body = { rootDocId: (this.rootDocId = 'root-doc-id') } this.res.sendStatus = code => { @@ -291,7 +291,7 @@ describe('ProjectController', function() { return this.ProjectController.deleteProject(this.req, this.res) }) - return it('should tell the project deleter to delete when forever=true', function(done) { + it('should tell the project deleter to delete when forever=true', function(done) { this.req.query = { forever: 'true' } this.res.sendStatus = code => { this.ProjectDeleter.deleteProject @@ -346,7 +346,7 @@ describe('ProjectController', function() { return this.ProjectController.newProject(this.req, this.res) }) - return it('should call the projectCreationHandler with createBasicProject', function(done) { + it('should call the projectCreationHandler with createBasicProject', function(done) { this.req.body.template = 'basic' this.res.send = json => { this.ProjectCreationHandler.createExampleProject.called.should.equal( @@ -530,7 +530,7 @@ describe('ProjectController', function() { return this.ProjectController.projectListPage(this.req, this.res) }) - return it('should not show for non sample users', function(done) { + it('should not show for non sample users', function(done) { this.user._id = '588f3ddae8ebc1bac07c9fff' // last two digits this.res.render = (pageName, opts) => { expect(opts.frontChatWidgetRoomId).to.equal(undefined) @@ -540,7 +540,7 @@ describe('ProjectController', function() { }) }) - return describe('with overleaf-integration-web-module hook', function() { + describe('with overleaf-integration-web-module hook', function() { beforeEach(function() { this.V1Response = { projects: [ @@ -603,7 +603,7 @@ describe('ProjectController', function() { return this.ProjectController.projectListPage(this.req, this.res) }) - return it('should have isShowingV1Projects flag', function(done) { + it('should have isShowingV1Projects flag', function(done) { this.res.render = (pageName, opts) => { opts.isShowingV1Projects.should.equal(true) return done() @@ -678,7 +678,7 @@ describe('ProjectController', function() { return this.ProjectController.projectListPage(this.req, this.res) }) - return it('should omit one of the projects', function(done) { + it('should omit one of the projects', function(done) { this.res.render = (pageName, opts) => { opts.projects.length.should.equal( this.projects.length + @@ -712,7 +712,7 @@ describe('ProjectController', function() { return this.ProjectController.renameProject(this.req, this.res) }) - return it('should send an error to next() if there is a problem', function(done) { + it('should send an error to next() if there is a problem', function(done) { let error this.EditorController.renameProject.callsArgWith( 2, @@ -848,7 +848,7 @@ describe('ProjectController', function() { return this.ProjectController.loadEditor(this.req, this.res) }) - return it('should expose the brand variation details as locals for branded projects', function(done) { + it('should expose the brand variation details as locals for branded projects', function(done) { this.ProjectGetter.getProject.callsArgWith(2, null, this.brandedProject) this.res.render = (pageName, opts) => { opts.brandVariation.should.deep.equal(this.brandVariationDetails) @@ -900,7 +900,7 @@ describe('ProjectController', function() { return done() }) - return it('should produce a list of projects', function(done) { + it('should produce a list of projects', function(done) { this.res.json = data => { expect(data).to.deep.equal({ projects: [ @@ -939,7 +939,7 @@ describe('ProjectController', function() { .callsArgWith(1, null, this.docs, this.files)) }) - return it('should produce a list of entities', function(done) { + it('should produce a list of entities', function(done) { this.res.json = data => { expect(data).to.deep.equal({ project_id: 'abcd', @@ -963,7 +963,7 @@ describe('ProjectController', function() { }) }) - return describe('_isInPercentageRollout', function() { + describe('_isInPercentageRollout', function() { before(function() { return (this.ids = [ '5a05cd7621f9fe22be131740', @@ -989,7 +989,7 @@ describe('ProjectController', function() { ]) }) - return it('should produce the expected results', function() { + it('should produce the expected results', function() { expect( this.ids.map(i => { return this.ProjectController._isInPercentageRollout('abcd', i, 50) diff --git a/services/web/test/unit/src/Project/ProjectCreationHandlerTests.js b/services/web/test/unit/src/Project/ProjectCreationHandlerTests.js index 3f68366657..60109362d8 100644 --- a/services/web/test/unit/src/Project/ProjectCreationHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectCreationHandlerTests.js @@ -286,7 +286,7 @@ describe('ProjectCreationHandler', function() { ) }) - return it('should send a project-imported event when importing a project', function(done) { + it('should send a project-imported event when importing a project', function(done) { const attributes = { overleaf: { history: { @@ -324,12 +324,12 @@ describe('ProjectCreationHandler', function() { ) }) - return it('should return the error to the callback', function() { + it('should return the error to the callback', function() { return should.exist(this.callback.args[0][0]) }) }) - return describe('with an invalid name', function() { + describe('with an invalid name', function() { beforeEach(function() { this.ProjectDetailsHandler.validateProjectName = sinon .stub() @@ -345,7 +345,7 @@ describe('ProjectCreationHandler', function() { return should.exist(this.callback.args[0][0]) }) - return it('should not try to create the project', function() { + it('should not try to create the project', function() { return this.ProjectModel.prototype.save.called.should.equal(false) }) }) @@ -391,7 +391,7 @@ describe('ProjectCreationHandler', function() { .should.equal(true) }) - return it('should build the mainbasic.tex template', function() { + it('should build the mainbasic.tex template', function() { return this.handler._buildTemplate .calledWith('mainbasic.tex', ownerId, projectName) .should.equal(true) @@ -421,7 +421,7 @@ describe('ProjectCreationHandler', function() { .should.equal(true) }) - return it('should create the root document', function() { + it('should create the root document', function() { return this.handler._createRootDoc .calledWith(this.project, ownerId, ['snippet line 1', 'snippet line 2']) .should.equal(true) @@ -504,7 +504,7 @@ describe('ProjectCreationHandler', function() { .should.equal(true) }) - return it('should build the references.bib template', function() { + it('should build the references.bib template', function() { return this.handler._buildTemplate .calledWith('references.bib', ownerId, projectName) .should.equal(true) @@ -548,13 +548,13 @@ describe('ProjectCreationHandler', function() { return done() }) - return it('should put the year in', function(done) { + it('should put the year in', function(done) { this.template.indexOf(new Date().getUTCFullYear()).should.not.equal(-1) return done() }) }) - return describe('_createRootDoc', function() { + describe('_createRootDoc', function() { beforeEach(function(done) { this.project = new this.ProjectModel() @@ -578,7 +578,7 @@ describe('ProjectCreationHandler', function() { .should.equal(true) }) - return it('should set the main doc id', function() { + it('should set the main doc id', function() { return this.ProjectEntityUpdateHandler.setRootDoc .calledWith(project_id, docId) .should.equal(true) diff --git a/services/web/test/unit/src/Project/ProjectDeleterTests.js b/services/web/test/unit/src/Project/ProjectDeleterTests.js index cd97e19f00..c7d5f18fd5 100644 --- a/services/web/test/unit/src/Project/ProjectDeleterTests.js +++ b/services/web/test/unit/src/Project/ProjectDeleterTests.js @@ -99,7 +99,7 @@ describe('ProjectDeleter', function() { }) }) - return it('should tell the editor controler so users are notified', function(done) { + it('should tell the editor controler so users are notified', function(done) { return this.deleter.markAsDeletedByExternalSource(project_id, () => { this.editorController.notifyUsersProjectHasBeenDeletedOrRenamed .calledWith(project_id) @@ -122,7 +122,7 @@ describe('ProjectDeleter', function() { ) }) - return it('should remove the flag from the project', function() { + it('should remove the flag from the project', function() { return this.Project.update .calledWith( { _id: this.project_id }, @@ -164,7 +164,7 @@ describe('ProjectDeleter', function() { }) }) - return it('should remove all the projects the user is a collaborator of', function(done) { + it('should remove all the projects the user is a collaborator of', function(done) { return this.deleter.deleteUsersProjects(this.user._id, () => { this.CollaboratorsHandler.removeUserFromAllProjets .calledWith(this.user._id) @@ -218,7 +218,7 @@ describe('ProjectDeleter', function() { }) }) - return it('should remove the project from Mongo', function(done) { + it('should remove the project from Mongo', function(done) { return this.deleter.deleteProject(this.project_id, () => { this.Project.remove .calledWith({ @@ -235,7 +235,7 @@ describe('ProjectDeleter', function() { return this.Project.update.callsArgWith(2) }) - return it('should update the project', function(done) { + it('should update the project', function(done) { return this.deleter.archiveProject(this.project_id, () => { this.Project.update .calledWith( @@ -252,12 +252,12 @@ describe('ProjectDeleter', function() { }) }) - return describe('restoreProject', function() { + describe('restoreProject', function() { beforeEach(function() { return this.Project.update.callsArgWith(2) }) - return it('should unset the archive attribute', function(done) { + it('should unset the archive attribute', function(done) { return this.deleter.restoreProject(this.project_id, () => { this.Project.update .calledWith( diff --git a/services/web/test/unit/src/Project/ProjectDetailsHandlerTests.js b/services/web/test/unit/src/Project/ProjectDetailsHandlerTests.js index 4658038d74..5981350fca 100644 --- a/services/web/test/unit/src/Project/ProjectDetailsHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectDetailsHandlerTests.js @@ -114,7 +114,7 @@ describe('ProjectDetailsHandler', function() { }) }) - return it('should return the error', function(done) { + it('should return the error', function(done) { const error = 'some error' this.ProjectGetter.getProject.callsArgWith(2, error) return this.handler.getDetails(this.project_id, err => { @@ -206,7 +206,7 @@ describe('ProjectDetailsHandler', function() { }) }) - return it('should append the supplied suffix to the project name, if passed', function(done) { + it('should append the supplied suffix to the project name, if passed', function(done) { return this.handler.transferOwnership('abc', '123', ' wombat', () => { sinon.assert.calledWith( this.handler.generateUniqueName, @@ -232,7 +232,7 @@ describe('ProjectDetailsHandler', function() { ) }) - return it('should return what the mongo call returns', function(done) { + it('should return what the mongo call returns', function(done) { const err = 'error' const description = 'cool project' this.ProjectGetter.getProject.callsArgWith(2, err, { description }) @@ -252,7 +252,7 @@ describe('ProjectDetailsHandler', function() { return (this.description = 'updated teh description') }) - return it('should update the project detials', function(done) { + it('should update the project detials', function(done) { this.ProjectModel.update.callsArgWith(2) return this.handler.setProjectDescription( this.project_id, @@ -300,7 +300,7 @@ describe('ProjectDetailsHandler', function() { }) }) - return it('should not do anything with an invalid name', function(done) { + it('should not do anything with an invalid name', function(done) { this.handler.validateProjectName = sinon .stub() .yields(new Error('invalid name')) @@ -351,7 +351,7 @@ describe('ProjectDetailsHandler', function() { ) }) - return it('should accept normal names', function(done) { + it('should accept normal names', function(done) { return this.handler.validateProjectName('foobar', function(error) { expect(error).to.not.exist return done() @@ -516,7 +516,7 @@ describe('ProjectDetailsHandler', function() { ) }) - return it('should not find a numeric index lower than the one already present', function(done) { + it('should not find a numeric index lower than the one already present', function(done) { return this.handler.ensureProjectNameIsUnique( this.user_id, 'numeric (31)', @@ -551,7 +551,7 @@ describe('ProjectDetailsHandler', function() { ).to.equal('a'.repeat(150)) }) - return it('should accept normal names', function() { + it('should accept normal names', function() { return expect(this.handler.fixProjectName('foobar')).to.equal('foobar') }) }) @@ -589,12 +589,12 @@ describe('ProjectDetailsHandler', function() { ) }) - return describe('when update produces an error', function() { + describe('when update produces an error', function() { beforeEach(function() { return this.ProjectModel.update.callsArgWith(2, new Error('woops')) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.handler.setPublicAccessLevel( this.project_id, this.accessLevel, @@ -608,7 +608,7 @@ describe('ProjectDetailsHandler', function() { }) }) - return describe('ensureTokensArePresent', function() { + describe('ensureTokensArePresent', function() { beforeEach(function() {}) describe('when the project has tokens', function() { @@ -652,7 +652,7 @@ describe('ProjectDetailsHandler', function() { ) }) - return it('should produce the tokens without error', function(done) { + it('should produce the tokens without error', function(done) { return this.handler.ensureTokensArePresent( this.project_id, (err, tokens) => { @@ -664,7 +664,7 @@ describe('ProjectDetailsHandler', function() { }) }) - return describe('when tokens are missing', function() { + describe('when tokens are missing', function() { beforeEach(function() { this.project = { _id: this.project_id } this.ProjectGetter.getProject = sinon @@ -728,7 +728,7 @@ describe('ProjectDetailsHandler', function() { ) }) - return it('should produce the tokens without error', function(done) { + it('should produce the tokens without error', function(done) { return this.handler.ensureTokensArePresent( this.project_id, (err, tokens) => { diff --git a/services/web/test/unit/src/Project/ProjectDuplicatorTests.js b/services/web/test/unit/src/Project/ProjectDuplicatorTests.js index eb065eef10..a9e1641f33 100644 --- a/services/web/test/unit/src/Project/ProjectDuplicatorTests.js +++ b/services/web/test/unit/src/Project/ProjectDuplicatorTests.js @@ -334,7 +334,7 @@ describe('ProjectDuplicator', function() { ) }) - return it('should copy all the files', function(done) { + it('should copy all the files', function(done) { return this.duplicator.duplicate( this.owner, this.old_project_id, @@ -376,7 +376,7 @@ describe('ProjectDuplicator', function() { }) }) - return describe('when there is an error', function() { + describe('when there is an error', function() { beforeEach(function() { return (this.rootFolder.fileRefs = [ { name: 'file0', _id: 'file0' }, @@ -414,7 +414,7 @@ describe('ProjectDuplicator', function() { ) }) - return it('should return an error', function(done) { + it('should return an error', function(done) { return this.duplicator.duplicate( this.owner, this.old_project_id, diff --git a/services/web/test/unit/src/Project/ProjectEditorHandlerTests.js b/services/web/test/unit/src/Project/ProjectEditorHandlerTests.js index 8fe24d8871..0fecfc5995 100644 --- a/services/web/test/unit/src/Project/ProjectEditorHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectEditorHandlerTests.js @@ -220,7 +220,7 @@ describe('ProjectEditorHandler', function() { ) }) - return it('should include invites', function() { + it('should include invites', function() { should.exist(this.result.invites) return this.result.invites.should.deep.equal(this.invites) }) @@ -248,7 +248,7 @@ describe('ProjectEditorHandler', function() { return result.deletedByExternalDataSource.should.equal(false) }) - return it('should set the deletedByExternalDataSource flag to true when it is true', function() { + it('should set the deletedByExternalDataSource flag to true when it is true', function() { this.project.deletedByExternalDataSource = true const result = this.handler.buildProjectModelView( this.project, @@ -260,7 +260,7 @@ describe('ProjectEditorHandler', function() { }) }) - return describe('features', function() { + describe('features', function() { beforeEach(function() { this.owner.features = { versioning: true, @@ -276,7 +276,7 @@ describe('ProjectEditorHandler', function() { )) }) - return it('should copy the owner features to the project', function() { + it('should copy the owner features to the project', function() { this.result.features.versioning.should.equal( this.owner.features.versioning ) @@ -293,7 +293,7 @@ describe('ProjectEditorHandler', function() { }) }) - return describe('buildOwnerAndMembersViews', function() { + describe('buildOwnerAndMembersViews', function() { beforeEach(function() { this.owner.features = { versioning: true, @@ -329,7 +329,7 @@ describe('ProjectEditorHandler', function() { ) }) - return describe('when there is no owner', function() { + describe('when there is no owner', function() { beforeEach(function() { // remove the owner from members list this.membersWithoutOwner = this.members.filter( @@ -353,7 +353,7 @@ describe('ProjectEditorHandler', function() { return expect(this.result.owner).to.equal(null) }) - return it('should not extract the ownerFeatures from the owner object', function() { + it('should not extract the ownerFeatures from the owner object', function() { return expect(this.result.ownerFeatures).to.equal(null) }) }) diff --git a/services/web/test/unit/src/Project/ProjectEntityHandlerTests.js b/services/web/test/unit/src/Project/ProjectEntityHandlerTests.js index 59091b5aa6..612abcdf9c 100644 --- a/services/web/test/unit/src/Project/ProjectEntityHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectEntityHandlerTests.js @@ -149,7 +149,7 @@ describe('ProjectEntityHandler', function() { .should.equal(true) }) - return it('should call the callback with the docs with the lines and rev included', function() { + it('should call the callback with the docs with the lines and rev included', function() { return this.callback .calledWith(null, { '/doc1': { @@ -175,7 +175,7 @@ describe('ProjectEntityHandler', function() { return this.ProjectEntityHandler.getAllFiles(project_id, this.callback) }) - return it('should call the callback with the files', function() { + it('should call the callback with the files', function() { return this.callback .calledWith(null, { '/file1': this.file1, @@ -206,7 +206,7 @@ describe('ProjectEntityHandler', function() { ) }) - return it('should call the callback with the path for each doc_id', function() { + it('should call the callback with the path for each doc_id', function() { this.expected = {} this.expected[this.doc1._id] = `/${this.doc1.name}` this.expected[this.doc2._id] = `/folder1/${this.doc2.name}` @@ -229,7 +229,7 @@ describe('ProjectEntityHandler', function() { .should.equal(true) }) - return it('should call the callback with the folders', function() { + it('should call the callback with the folders', function() { return this.callback .calledWith(null, { '/': this.project.rootFolder[0], @@ -239,7 +239,7 @@ describe('ProjectEntityHandler', function() { }) }) - return describe('_getAllFoldersFromProject', function() { + describe('_getAllFoldersFromProject', function() { beforeEach(function() { this.callback = sinon.stub() return this.ProjectEntityHandler._getAllFoldersFromProject( @@ -248,7 +248,7 @@ describe('ProjectEntityHandler', function() { ) }) - return it('should call the callback with the folders', function() { + it('should call the callback with the folders', function() { return this.callback .calledWith(null, { '/': this.project.rootFolder[0], @@ -334,7 +334,7 @@ describe('ProjectEntityHandler', function() { })() }) - return it('should flush each file to the TPDS', function() { + it('should flush each file to the TPDS', function() { return (() => { const result = [] for (let path in this.files) { @@ -356,7 +356,7 @@ describe('ProjectEntityHandler', function() { }) }) - return describe('getDoc', function() { + describe('getDoc', function() { beforeEach(function() { this.lines = ['mock', 'doc', 'lines'] this.rev = 5 @@ -375,7 +375,7 @@ describe('ProjectEntityHandler', function() { .should.equal(true) }) - return it('should call the callback with the lines, version and rev', function() { + it('should call the callback with the lines, version and rev', function() { return this.callback .calledWith(null, this.lines, this.rev, this.version, this.ranges) .should.equal(true) diff --git a/services/web/test/unit/src/Project/ProjectEntityMongoUpdateHandlerTests.js b/services/web/test/unit/src/Project/ProjectEntityMongoUpdateHandlerTests.js index 94831db594..e711df1761 100644 --- a/services/web/test/unit/src/Project/ProjectEntityMongoUpdateHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectEntityMongoUpdateHandlerTests.js @@ -105,7 +105,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { .should.equal(true) }) - return it('puts the element in mongo', function() { + it('puts the element in mongo', function() { return this.subject._putElement .calledWith(this.project, folder_id, this.doc, 'doc', this.callback) .should.equal(true) @@ -142,7 +142,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { .should.equal(true) }) - return it('puts the element in mongo', function() { + it('puts the element in mongo', function() { return this.subject._putElement .calledWith(this.project, folder_id, this.file, 'file', this.callback) .should.equal(true) @@ -229,7 +229,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { .should.equal(true) }) - return it('calls the callback', function() { + it('calls the callback', function() { return this.callback .calledWith(null, this.file, this.project, this.path, this.newProject) .should.equal(true) @@ -361,7 +361,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { ) }) - return it('should use a case-sensitive match if exactCaseMatch option is set', function(done) { + it('should use a case-sensitive match if exactCaseMatch option is set', function(done) { const path = '/differentFolder/' return this.subject.mkdirp( project_id, @@ -472,7 +472,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { .should.equal(true) }) - return it('calls the callback', function() { + it('calls the callback', function() { const changes = { oldDocs: this.oldDocs, newDocs: this.newDocs, @@ -565,7 +565,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { ) }) - return it('calls the callback with an error', function() { + it('calls the callback with an error', function() { return this.callback.calledWith(new Error()).should.equal(true) }) }) @@ -612,7 +612,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { .should.equal(true) }) - return it('calls the callbck', function() { + it('calls the callbck', function() { return this.callback .calledWith(null, this.doc, this.path, this.project) .should.equal(true) @@ -701,7 +701,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { .should.equal(true) }) - return it('calls the callback', function() { + it('calls the callback', function() { const changes = { oldDocs: this.oldDocs, newDocs: this.newDocs, @@ -765,7 +765,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { .should.equal(true) }) - return it('calls the callback', function() { + it('calls the callback', function() { const folderMatcher = sinon.match(folder => { return folder.name === this.folderName }) @@ -807,7 +807,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.calledWith(null, this.project).should.equal(true) }) }) @@ -873,7 +873,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { return expect(this.subject._countElements(this.project)).to.equal(23) }) - return it('should deal with null fileRefs', function() { + it('should deal with null fileRefs', function() { this.project.rootFolder[0].folders[0].folders[0].fileRefs = undefined return expect(this.subject._countElements(this.project)).to.equal(23) }) @@ -905,7 +905,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { .yields(null, this.project)) }) - return describe('updating the project', function() { + describe('updating the project', function() { it('should use the correct mongo path', function(done) { return this.subject._putElement( this.project, @@ -1108,7 +1108,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { ) }) - return it('should error if a folder already exists with the same name', function(done) { + it('should error if a folder already exists with the same name', function(done) { const doc = { _id: ObjectId(), name: 'another-folder' @@ -1169,7 +1169,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { ) }) - return it('returns nothing if name is valid', function() { + it('returns nothing if name is valid', function() { return this.subject._checkValidElementName( this.folder, 'unique_name', @@ -1205,7 +1205,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { ) }) - return it('returns an error if trying to move a folder inside itself', function() { + it('returns an error if trying to move a folder inside itself', function() { const folder = { name: 'folder_name' } return this.subject._checkValidMove( this.project, @@ -1224,7 +1224,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { }) }) - return describe('_insertDeletedDocReference', function() { + describe('_insertDeletedDocReference', function() { beforeEach(function() { this.doc = { _id: ObjectId(), @@ -1258,7 +1258,7 @@ describe('ProjectEntityMongoUpdateHandler', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) diff --git a/services/web/test/unit/src/Project/ProjectEntityUpdateHandlerTests.js b/services/web/test/unit/src/Project/ProjectEntityUpdateHandlerTests.js index db789b809f..a556789b05 100644 --- a/services/web/test/unit/src/Project/ProjectEntityUpdateHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectEntityUpdateHandlerTests.js @@ -186,7 +186,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('should should send the change in project structure to the doc updater', function() { + it('should should send the change in project structure to the doc updater', function() { const changesMatcher = sinon.match(changes => { const { newFiles } = changes if (newFiles.length !== 1) { @@ -244,7 +244,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('should put file into folder by calling put element, with the linkedFileData and hash', function() { + it('should put file into folder by calling put element, with the linkedFileData and hash', function() { return this.ProjectEntityMongoUpdateHandler._putElement .calledWithMatch( this.project, @@ -348,7 +348,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -378,7 +378,7 @@ describe('ProjectEntityUpdateHandler', function() { return this.TpdsUpdateSender.addDoc.called.should.equal(false) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -425,7 +425,7 @@ describe('ProjectEntityUpdateHandler', function() { return this.TpdsUpdateSender.addDoc.called.should.equal(false) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -458,14 +458,14 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('should return a not found error', function() { + it('should return a not found error', function() { return this.callback .calledWith(new Errors.NotFoundError()) .should.equal(true) }) }) - return describe('when the project is not found', function() { + describe('when the project is not found', function() { beforeEach(function() { this.ProjectGetter.getProjectWithoutDocLines = sinon.stub().yields() return this.ProjectEntityUpdateHandler.updateDocLines( @@ -480,7 +480,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('should return a not found error', function() { + it('should return a not found error', function() { return this.callback .calledWith(new Errors.NotFoundError()) .should.equal(true) @@ -541,7 +541,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('sends the change in project structure to the doc updater', function() { + it('sends the change in project structure to the doc updater', function() { const newDocs = [ { doc: this.newDoc, @@ -558,7 +558,7 @@ describe('ProjectEntityUpdateHandler', function() { }) }) - return describe('adding a doc with an invalid name', function() { + describe('adding a doc with an invalid name', function() { beforeEach(function() { this.path = '/path/to/doc' @@ -573,7 +573,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('returns an error', function() { + it('returns an error', function() { const errorMatcher = sinon.match.instanceOf(Errors.InvalidNameError) return this.callback.calledWithMatch(errorMatcher).should.equal(true) }) @@ -641,7 +641,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('sends the change in project structure to the doc updater', function() { + it('sends the change in project structure to the doc updater', function() { const newFiles = [ { file: this.newFile, @@ -658,7 +658,7 @@ describe('ProjectEntityUpdateHandler', function() { }) }) - return describe('adding a file with an invalid name', function() { + describe('adding a file with an invalid name', function() { beforeEach(function() { this.path = '/path/to/file' @@ -683,7 +683,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('returns an error', function() { + it('returns an error', function() { const errorMatcher = sinon.match.instanceOf(Errors.InvalidNameError) return this.callback.calledWithMatch(errorMatcher).should.equal(true) }) @@ -763,7 +763,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('updates the project structure in the doc updater', function() { + it('updates the project structure in the doc updater', function() { const oldFiles = [ { file: this.oldFile, @@ -802,7 +802,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('returns an error', function() { + it('returns an error', function() { const errorMatcher = sinon.match.instanceOf(Error) return this.callback.calledWithMatch(errorMatcher).should.equal(true) }) @@ -851,7 +851,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('returns the doc', function() { + it('returns the doc', function() { return this.callback.calledWith(null, this.existingDoc, false) }) }) @@ -895,12 +895,12 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('returns the doc', function() { + it('returns the doc', function() { return this.callback.calledWith(null, this.newDoc, true) }) }) - return describe('upserting a new doc with an invalid name', function() { + describe('upserting a new doc with an invalid name', function() { beforeEach(function() { this.folder = { _id: folder_id, docs: [] } this.newDoc = { _id: doc_id } @@ -920,7 +920,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('returns an error', function() { + it('returns an error', function() { const errorMatcher = sinon.match.instanceOf(Errors.InvalidNameError) return this.callback.calledWithMatch(errorMatcher).should.equal(true) }) @@ -948,7 +948,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('returns an error', function() { + it('returns an error', function() { const errorMatcher = sinon.match.instanceOf(Error) return this.callback.calledWithMatch(errorMatcher).should.equal(true) }) @@ -986,7 +986,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('returns the file', function() { + it('returns the file', function() { return this.callback.calledWith(null, this.existingFile, false) }) }) @@ -1030,12 +1030,12 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('returns the file', function() { + it('returns the file', function() { return this.callback.calledWith(null, this.newFile, true) }) }) - return describe('upserting a new file with an invalid name', function() { + describe('upserting a new file with an invalid name', function() { beforeEach(function() { this.folder = { _id: folder_id, fileRefs: [] } this.newFile = { _id: file_id } @@ -1055,7 +1055,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('returns an error', function() { + it('returns an error', function() { const errorMatcher = sinon.match.instanceOf(Errors.InvalidNameError) return this.callback.calledWithMatch(errorMatcher).should.equal(true) }) @@ -1106,7 +1106,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('calls the callback', function() { + it('calls the callback', function() { return this.callback .calledWith( null, @@ -1143,13 +1143,13 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('returns an error', function() { + it('returns an error', function() { const errorMatcher = sinon.match.instanceOf(Errors.InvalidNameError) return this.callback.calledWithMatch(errorMatcher).should.equal(true) }) }) - return describe('upserting a doc with an invalid name', function() { + describe('upserting a doc with an invalid name', function() { beforeEach(function() { this.path = '/folder/*doc.tex' this.newFolders = ['mock-a', 'mock-b'] @@ -1173,7 +1173,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('returns an error', function() { + it('returns an error', function() { const errorMatcher = sinon.match.instanceOf(Errors.InvalidNameError) return this.callback.calledWithMatch(errorMatcher).should.equal(true) }) @@ -1227,7 +1227,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('calls the callback', function() { + it('calls the callback', function() { return this.callback .calledWith( null, @@ -1265,13 +1265,13 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('returns an error', function() { + it('returns an error', function() { const errorMatcher = sinon.match.instanceOf(Errors.InvalidNameError) return this.callback.calledWithMatch(errorMatcher).should.equal(true) }) }) - return describe('upserting a file with an invalid name', function() { + describe('upserting a file with an invalid name', function() { beforeEach(function() { this.path = '/folder/*file.png' this.newFolders = ['mock-a', 'mock-b'] @@ -1295,7 +1295,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('returns an error', function() { + it('returns an error', function() { const errorMatcher = sinon.match.instanceOf(Errors.InvalidNameError) return this.callback.calledWithMatch(errorMatcher).should.equal(true) }) @@ -1358,7 +1358,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('retuns the entity_id', function() { + it('retuns the entity_id', function() { return this.callback.calledWith(null, doc_id).should.equal(true) }) }) @@ -1388,14 +1388,14 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('deletes the entity', function() { + it('deletes the entity', function() { return this.ProjectEntityUpdateHandler.deleteEntity.withoutLock .calledWith(project_id, this.doc._id, 'doc', userId, this.callback) .should.equal(true) }) }) - return describe('when the entity does not exist', function() { + describe('when the entity does not exist', function() { beforeEach(function() { this.ProjectLocator.findElementByPath = sinon.stub().yields() this.path = '/doc.tex' @@ -1407,7 +1407,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('returns an error', function() { + it('returns an error', function() { return this.callback .calledWith(new Errors.NotFoundError()) .should.equal(true) @@ -1426,7 +1426,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('calls ProjectEntityMongoUpdateHandler', function() { + it('calls ProjectEntityMongoUpdateHandler', function() { return this.ProjectEntityMongoUpdateHandler.mkdirp .calledWith(project_id, this.docPath) .should.equal(true) @@ -1444,7 +1444,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('calls ProjectEntityMongoUpdateHandler', function() { + it('calls ProjectEntityMongoUpdateHandler', function() { return this.ProjectEntityMongoUpdateHandler.mkdirp .calledWith(project_id, this.docPath, { exactCaseMatch: true }) .should.equal(true) @@ -1465,14 +1465,14 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('calls ProjectEntityMongoUpdateHandler', function() { + it('calls ProjectEntityMongoUpdateHandler', function() { return this.ProjectEntityMongoUpdateHandler.addFolder .calledWith(project_id, this.parentFolder_id, this.folderName) .should.equal(true) }) }) - return describe('adding a folder with an invalid name', function() { + describe('adding a folder with an invalid name', function() { beforeEach(function() { this.parentFolder_id = '123asdf' this.folderName = '*new-folder' @@ -1485,7 +1485,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('returns an error', function() { + it('returns an error', function() { const errorMatcher = sinon.match.instanceOf(Errors.InvalidNameError) return this.callback.calledWithMatch(errorMatcher).should.equal(true) }) @@ -1540,7 +1540,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('sends the changes in project structure to the doc updater', function() { + it('sends the changes in project structure to the doc updater', function() { return this.DocumentUpdaterHandler.updateProjectStructure .calledWith( project_id, @@ -1603,7 +1603,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('sends the changes in project structure to the doc updater', function() { + it('sends the changes in project structure to the doc updater', function() { return this.DocumentUpdaterHandler.updateProjectStructure .calledWith( project_id, @@ -1616,7 +1616,7 @@ describe('ProjectEntityUpdateHandler', function() { }) }) - return describe('renaming an entity to an invalid name', function() { + describe('renaming an entity to an invalid name', function() { beforeEach(function() { this.project_name = 'project name' this.startPath = '/folder/a.tex' @@ -1647,7 +1647,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('returns an error', function() { + it('returns an error', function() { const errorMatcher = sinon.match.instanceOf(Errors.InvalidNameError) return this.callback.calledWithMatch(errorMatcher).should.equal(true) }) @@ -1665,7 +1665,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('should return an error', function() { + it('should return an error', function() { const error = new Errors.ProjectHistoryDisabledError( `project history not enabled for ${project_id}` ) @@ -1684,7 +1684,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('should return an error', function() { + it('should return an error', function() { const error = new Errors.ProjectHistoryDisabledError( `project history not enabled for ${project_id}` ) @@ -1692,7 +1692,7 @@ describe('ProjectEntityUpdateHandler', function() { }) }) - return describe('a project with project-history enabled', function() { + describe('a project with project-history enabled', function() { beforeEach(function() { this.ProjectGetter.getProject = sinon.stub().yields(null, this.project) const docs = [ @@ -1755,7 +1755,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('calls the callback', function() { + it('calls the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -1804,7 +1804,7 @@ describe('ProjectEntityUpdateHandler', function() { return this.DocumentUpdaterHandler.deleteDoc.called.should.equal(false) }) - return it('should should send the update to the doc updater', function() { + it('should should send the update to the doc updater', function() { const oldFiles = [{ file: this.entity, path: this.path }] return this.DocumentUpdaterHandler.updateProjectStructure .calledWith(project_id, projectHistoryId, userId, { @@ -1838,7 +1838,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('should should send the update to the doc updater', function() { + it('should should send the update to the doc updater', function() { const oldDocs = [{ doc: this.entity, path: this.path }] return this.DocumentUpdaterHandler.updateProjectStructure .calledWith(project_id, projectHistoryId, userId, { @@ -1849,7 +1849,7 @@ describe('ProjectEntityUpdateHandler', function() { }) }) - return describe('a folder', function() { + describe('a folder', function() { beforeEach(function(done) { this.folder = { folders: [ @@ -1909,7 +1909,7 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('should should send one update to the doc updater for all docs and files', function() { + it('should should send one update to the doc updater for all docs and files', function() { const oldFiles = [ { file: this.file2, path: '/folder/file-name-2' }, { file: this.file1, path: '/folder/subfolder/file-name-1' } @@ -1929,7 +1929,7 @@ describe('ProjectEntityUpdateHandler', function() { }) }) - return describe('_cleanUpDoc', function() { + describe('_cleanUpDoc', function() { beforeEach(function() { this.doc = { _id: ObjectId(), @@ -1982,12 +1982,12 @@ describe('ProjectEntityUpdateHandler', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) - return describe('when the doc is not the root doc', function() { + describe('when the doc is not the root doc', function() { beforeEach(function() { this.project.rootDoc_id = ObjectId() return this.ProjectEntityUpdateHandler._cleanUpDoc( @@ -2005,7 +2005,7 @@ describe('ProjectEntityUpdateHandler', function() { ) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) diff --git a/services/web/test/unit/src/Project/ProjectGetterTests.js b/services/web/test/unit/src/Project/ProjectGetterTests.js index f194021a25..c971b464ba 100644 --- a/services/web/test/unit/src/Project/ProjectGetterTests.js +++ b/services/web/test/unit/src/Project/ProjectGetterTests.js @@ -63,7 +63,7 @@ describe('ProjectGetter', function() { return (this.ProjectGetter.getProject = sinon.stub().yields()) }) - return describe('passing an id', function() { + describe('passing an id', function() { beforeEach(function() { return this.ProjectGetter.getProjectWithoutDocLines( this.project_id, @@ -94,7 +94,7 @@ describe('ProjectGetter', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -106,7 +106,7 @@ describe('ProjectGetter', function() { return (this.ProjectGetter.getProject = sinon.stub().yields()) }) - return describe('passing an id', function() { + describe('passing an id', function() { beforeEach(function() { return this.ProjectGetter.getProjectWithOnlyFolders( this.project_id, @@ -144,7 +144,7 @@ describe('ProjectGetter', function() { .should.equal(true) }) - return it('should call the callback with the project', function() { + it('should call the callback with the project', function() { return this.callback.called.should.equal(true) }) }) @@ -164,7 +164,7 @@ describe('ProjectGetter', function() { return this.ProjectGetter.getProject(this.project_id, this.callback) }) - return it('should call find with the project id', function() { + it('should call find with the project id', function() { expect(this.db.projects.find.callCount).to.equal(1) return expect(this.db.projects.find.lastCall.args[0]).to.deep.equal({ _id: ObjectId(this.project_id) @@ -172,19 +172,19 @@ describe('ProjectGetter', function() { }) }) - return describe('without project id', function() { + describe('without project id', function() { beforeEach(function() { return this.ProjectGetter.getProject(null, this.callback) }) - return it('should callback with error', function() { + it('should callback with error', function() { expect(this.db.projects.find.callCount).to.equal(0) return expect(this.callback.lastCall.args[0]).to.be.instanceOf(Error) }) }) }) - return describe('with projection', function() { + describe('with projection', function() { beforeEach(function() { return (this.projection = { _id: 1 }) }) @@ -198,7 +198,7 @@ describe('ProjectGetter', function() { ) }) - return it('should call find with the project id', function() { + it('should call find with the project id', function() { expect(this.db.projects.find.callCount).to.equal(1) expect(this.db.projects.find.lastCall.args[0]).to.deep.equal({ _id: ObjectId(this.project_id) @@ -209,12 +209,12 @@ describe('ProjectGetter', function() { }) }) - return describe('without project id', function() { + describe('without project id', function() { beforeEach(function() { return this.ProjectGetter.getProject(null, this.callback) }) - return it('should callback with error', function() { + it('should callback with error', function() { expect(this.db.projects.find.callCount).to.equal(0) return expect(this.callback.lastCall.args[0]).to.be.instanceOf(Error) }) @@ -239,7 +239,7 @@ describe('ProjectGetter', function() { ) }) - return it('should call find with the project id', function() { + it('should call find with the project id', function() { expect(this.db.projects.find.callCount).to.equal(1) return expect(this.db.projects.find.lastCall.args[0]).to.deep.equal({ _id: ObjectId(this.project_id) @@ -247,19 +247,19 @@ describe('ProjectGetter', function() { }) }) - return describe('without project id', function() { + describe('without project id', function() { beforeEach(function() { return this.ProjectGetter.getProjectWithoutLock(null, this.callback) }) - return it('should callback with error', function() { + it('should callback with error', function() { expect(this.db.projects.find.callCount).to.equal(0) return expect(this.callback.lastCall.args[0]).to.be.instanceOf(Error) }) }) }) - return describe('with projection', function() { + describe('with projection', function() { beforeEach(function() { return (this.projection = { _id: 1 }) }) @@ -273,7 +273,7 @@ describe('ProjectGetter', function() { ) }) - return it('should call find with the project id', function() { + it('should call find with the project id', function() { expect(this.db.projects.find.callCount).to.equal(1) expect(this.db.projects.find.lastCall.args[0]).to.deep.equal({ _id: ObjectId(this.project_id) @@ -284,12 +284,12 @@ describe('ProjectGetter', function() { }) }) - return describe('without project id', function() { + describe('without project id', function() { beforeEach(function() { return this.ProjectGetter.getProjectWithoutLock(null, this.callback) }) - return it('should callback with error', function() { + it('should callback with error', function() { expect(this.db.projects.find.callCount).to.equal(0) return expect(this.callback.lastCall.args[0]).to.be.instanceOf(Error) }) @@ -320,7 +320,7 @@ describe('ProjectGetter', function() { ) }) - return it('should call the callback with all the projects', function() { + it('should call the callback with all the projects', function() { return this.callback .calledWith(null, { owned: ['mock-owned-projects'], @@ -333,7 +333,7 @@ describe('ProjectGetter', function() { }) }) - return describe('getProjectIdByReadAndWriteToken', function() { + describe('getProjectIdByReadAndWriteToken', function() { describe('when project find returns project', function() { this.beforeEach(function() { this.Project.findOne = sinon.stub().yields(null, { _id: 'project-id' }) @@ -349,7 +349,7 @@ describe('ProjectGetter', function() { .should.equal(true) }) - return it('should callback with project id', function() { + it('should callback with project id', function() { return this.callback.calledWith(null, 'project-id').should.equal(true) }) }) @@ -363,12 +363,12 @@ describe('ProjectGetter', function() { ) }) - return it('should callback empty', function() { + it('should callback empty', function() { return expect(this.callback.firstCall.args.length).to.equal(0) }) }) - return describe('when project find returns error', function() { + describe('when project find returns error', function() { this.beforeEach(function() { this.Project.findOne = sinon.stub().yields('error') return this.ProjectGetter.getProjectIdByReadAndWriteToken( @@ -377,7 +377,7 @@ describe('ProjectGetter', function() { ) }) - return it('should callback with error', function() { + it('should callback with error', function() { return this.callback.calledWith('error').should.equal(true) }) }) diff --git a/services/web/test/unit/src/Project/ProjectHelperTests.js b/services/web/test/unit/src/Project/ProjectHelperTests.js index d68706e54a..6fd6349687 100644 --- a/services/web/test/unit/src/Project/ProjectHelperTests.js +++ b/services/web/test/unit/src/Project/ProjectHelperTests.js @@ -22,7 +22,7 @@ describe('ProjectHelper', function() { return (this.ProjectHelper = SandboxedModule.require(modulePath)) }) - return describe('compilerFromV1Engine', function() { + describe('compilerFromV1Engine', function() { it('returns the correct engine for latex_dvipdf', function() { return expect( this.ProjectHelper.compilerFromV1Engine('latex_dvipdf') @@ -41,7 +41,7 @@ describe('ProjectHelper', function() { ).to.equal('xelatex') }) - return it('returns the correct engine for lualatex', function() { + it('returns the correct engine for lualatex', function() { return expect( this.ProjectHelper.compilerFromV1Engine('lualatex') ).to.equal('lualatex') diff --git a/services/web/test/unit/src/Project/ProjectHistoryHandlerTests.js b/services/web/test/unit/src/Project/ProjectHistoryHandlerTests.js index 2dc6db9e14..1b7ff936d1 100644 --- a/services/web/test/unit/src/Project/ProjectHistoryHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectHistoryHandlerTests.js @@ -63,7 +63,7 @@ describe('ProjectHistoryHandler', function() { })) }) - return describe('starting history for an existing project', function() { + describe('starting history for an existing project', function() { beforeEach(function() { this.newHistoryId = 123456789 this.HistoryManager.initializeProject = sinon @@ -119,12 +119,12 @@ describe('ProjectHistoryHandler', function() { .should.equal(true) }) - return it('should call the callback without an error', function() { + it('should call the callback without an error', function() { return this.callback.called.should.equal(true) }) }) - return describe('when the history already exists', function() { + describe('when the history already exists', function() { beforeEach(function() { this.project.overleaf = { history: { id: 1234 } } this.ProjectDetailsHandler.getDetails = sinon @@ -162,7 +162,7 @@ describe('ProjectHistoryHandler', function() { return this.HistoryManager.flushProject.called.should.equal(false) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.calledWith().should.equal(true) }) }) diff --git a/services/web/test/unit/src/Project/ProjectLocatorTests.js b/services/web/test/unit/src/Project/ProjectLocatorTests.js index 542114f477..2b2d5d62a4 100644 --- a/services/web/test/unit/src/Project/ProjectLocatorTests.js +++ b/services/web/test/unit/src/Project/ProjectLocatorTests.js @@ -110,7 +110,7 @@ describe('ProjectLocator', function() { ) }) - return it('should give error if element could not be found', function(done) { + it('should give error if element could not be found', function(done) { return this.locator.findElement( { project_id: project._id, element_id: 'ddsd432nj42', type: 'docs' }, function(err, foundElement, path, parentFolder) { @@ -147,7 +147,7 @@ describe('ProjectLocator', function() { ) }) - return it('when deeply nested', function(done) { + it('when deeply nested', function(done) { return this.locator.findElement( { project_id: project._id, @@ -183,7 +183,7 @@ describe('ProjectLocator', function() { ) }) - return it('when deeply nested', function(done) { + it('when deeply nested', function(done) { return this.locator.findElement( { project_id: project._id, @@ -216,7 +216,7 @@ describe('ProjectLocator', function() { ) }) - return it('should convert file to fileRefs', function(done) { + it('should convert file to fileRefs', function(done) { return this.locator.findElement( { project_id: project._id, element_id: file1._id, type: 'fileRefs' }, function(err, foundElement, path, parentFolder) { @@ -241,7 +241,7 @@ describe('ProjectLocator', function() { _id: '1234566', rootFolder: [rootFolder2] } - return it('should find doc in project', function(done) { + it('should find doc in project', function(done) { return this.locator.findElement( { project: project2, element_id: doc3._id, type: 'docs' }, function(err, foundElement, path, parentFolder) { @@ -282,7 +282,7 @@ describe('ProjectLocator', function() { }) }) - return it('should return null when the rootDoc_id no longer exists', function(done) { + it('should return null when the rootDoc_id no longer exists', function(done) { project.rootDoc_id = 'doesntexist' return this.locator.findRootDoc(project, function(err, doc) { assert(err == null) @@ -462,7 +462,7 @@ describe('ProjectLocator', function() { ) }) // mocha will throw exception if done called multiple times - return it('should not call the callback more than once when the path is longer than 1 level below the duplicate level', function(done) { + it('should not call the callback more than once when the path is longer than 1 level below the duplicate level', function(done) { const path = `${this.duplicateFolder.name}/1/main.tex` return this.locator.findElementByPath( { project: this.project, path }, @@ -484,7 +484,7 @@ describe('ProjectLocator', function() { }) }) - return it('should not crash with a null', function(done) { + it('should not crash with a null', function(done) { const path = '/other.tex' return this.locator.findElementByPath( { project: this.project, path }, @@ -501,7 +501,7 @@ describe('ProjectLocator', function() { return (this.ProjectGetter = { getProject: sinon.stub().callsArg(2) }) }) - return it('should not crash with a null', function(done) { + it('should not crash with a null', function(done) { const path = '/other.tex' return this.locator.findElementByPath( { project_id: project._id, path }, @@ -513,7 +513,7 @@ describe('ProjectLocator', function() { }) }) - return describe('with a project_id', () => + describe('with a project_id', () => it('should take a doc path and return the element for a root level document', function(done) { const path = `${doc1.name}` return this.locator.findElementByPath( @@ -530,7 +530,7 @@ describe('ProjectLocator', function() { })) }) - return describe('findUsersProjectByName finding a project by user_id and project name', function() { + describe('findUsersProjectByName finding a project by user_id and project name', function() { it('should return the project from an array case insenstive', function(done) { const user_id = '123jojoidns' const stubbedProject = { name: 'findThis' } @@ -581,7 +581,7 @@ describe('ProjectLocator', function() { ) }) - return it('should search collab projects as well', function(done) { + it('should search collab projects as well', function(done) { const user_id = '123jojoidns' const stubbedProject = { name: 'findThis' } const projects = { diff --git a/services/web/test/unit/src/Project/ProjectOptionsHandlerTests.js b/services/web/test/unit/src/Project/ProjectOptionsHandlerTests.js index 667f36b06b..c6a28157cb 100644 --- a/services/web/test/unit/src/Project/ProjectOptionsHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectOptionsHandlerTests.js @@ -64,7 +64,7 @@ describe('ProjectOptionsHandler', function() { return this.projectModel.update.args[0][3]() }) - return it('should not perform and update on mongo if it is not a reconised compiler', function(done) { + it('should not perform and update on mongo if it is not a reconised compiler', function(done) { return this.handler.setCompiler(project_id, 'something', err => { this.projectModel.update.called.should.equal(false) return done() @@ -83,7 +83,7 @@ describe('ProjectOptionsHandler', function() { return this.projectModel.update.args[0][3]() }) - return it('should not perform and update on mongo if it is not a reconised compiler', function(done) { + it('should not perform and update on mongo if it is not a reconised compiler', function(done) { return this.handler.setImageName(project_id, 'something', err => { this.projectModel.update.called.should.equal(false) return done() @@ -113,7 +113,7 @@ describe('ProjectOptionsHandler', function() { ) }) - return it('should perform and update on mongo if the language is blank (means turn it off)', function(done) { + it('should perform and update on mongo if the language is blank (means turn it off)', function(done) { this.handler.setSpellCheckLanguage(project_id, '', err => { this.projectModel.update.called.should.equal(true) return done() @@ -140,7 +140,7 @@ describe('ProjectOptionsHandler', function() { }) }) - return it('should not perform and update on mongo if brand variation is an empty string', function(done) { + it('should not perform and update on mongo if brand variation is an empty string', function(done) { return this.handler.setBrandVariationId(project_id, '', err => { this.projectModel.update.called.should.equal(false) return done() @@ -148,7 +148,7 @@ describe('ProjectOptionsHandler', function() { }) }) - return describe('unsetting the brandVariationId', () => + describe('unsetting the brandVariationId', () => it('should perform and update on mongo', function(done) { this.handler.unsetBrandVariationId(project_id, err => { const args = this.projectModel.update.args[0] diff --git a/services/web/test/unit/src/Project/ProjectRootDocManagerTests.js b/services/web/test/unit/src/Project/ProjectRootDocManagerTests.js index e6577fcd19..ec396c649f 100644 --- a/services/web/test/unit/src/Project/ProjectRootDocManagerTests.js +++ b/services/web/test/unit/src/Project/ProjectRootDocManagerTests.js @@ -100,7 +100,7 @@ describe('ProjectRootDocManager', function() { .should.equal(true) }) - return it('should set the root doc to the doc containing a documentclass', function() { + it('should set the root doc to the doc containing a documentclass', function() { return this.ProjectEntityUpdateHandler.setRootDoc .calledWith(this.project_id, 'doc-id-2') .should.equal(true) @@ -131,14 +131,14 @@ describe('ProjectRootDocManager', function() { ) }) - return it('should set the root doc to the doc containing a documentclass', function() { + it('should set the root doc to the doc containing a documentclass', function() { return this.ProjectEntityUpdateHandler.setRootDoc .calledWith(this.project_id, 'doc-id-2') .should.equal(true) }) }) - return describe('when there is no suitable root doc', function() { + describe('when there is no suitable root doc', function() { beforeEach(function(done) { this.docs = { '/chapter1.tex': { @@ -162,7 +162,7 @@ describe('ProjectRootDocManager', function() { ) }) - return it('should not set the root doc to the doc containing a documentclass', function() { + it('should not set the root doc to the doc containing a documentclass', function() { return this.ProjectEntityUpdateHandler.setRootDoc.called.should.equal( false ) @@ -220,7 +220,7 @@ describe('ProjectRootDocManager', function() { ) }) - return it('processes smaller files first', function(done) { + it('processes smaller files first', function(done) { this.fs.stat.withArgs('/foo/c.tex').callsArgWith(1, null, { size: 1 }) return this.ProjectRootDocManager.findRootDocFileFromDirectory( '/foo', @@ -258,7 +258,7 @@ describe('ProjectRootDocManager', function() { ) }) - return it('processes main.text first and stops processing when it finds the content', function(done) { + it('processes main.text first and stops processing when it finds the content', function(done) { return this.ProjectRootDocManager.findRootDocFileFromDirectory( '/foo', () => { @@ -289,7 +289,7 @@ describe('ProjectRootDocManager', function() { ) }) - return it('processes main.text first and stops processing when it finds the content', function(done) { + it('processes main.text first and stops processing when it finds the content', function(done) { return this.ProjectRootDocManager.findRootDocFileFromDirectory( '/foo', () => { @@ -315,7 +315,7 @@ describe('ProjectRootDocManager', function() { ) }) - return it('processes all the files', function(done) { + it('processes all the files', function(done) { return this.ProjectRootDocManager.findRootDocFileFromDirectory( '/foo', () => { @@ -328,14 +328,14 @@ describe('ProjectRootDocManager', function() { }) }) - return describe('when there is an error reading a file', function() { + describe('when there is an error reading a file', function() { beforeEach(function() { return this.fs.readFile .withArgs('/foo/a.tex') .callsArgWith(2, new Error('something went wrong')) }) - return it('returns an error', function(done) { + it('returns an error', function(done) { return this.ProjectRootDocManager.findRootDocFileFromDirectory( '/foo', (error, path, content) => { @@ -377,7 +377,7 @@ describe('ProjectRootDocManager', function() { .should.equal(true) }) - return it('should set the root doc to main.tex', function() { + it('should set the root doc to main.tex', function() { return this.ProjectEntityUpdateHandler.setRootDoc .calledWith(this.project_id, 'doc-id-2') .should.equal(true) @@ -405,7 +405,7 @@ describe('ProjectRootDocManager', function() { .should.equal(true) }) - return it('should set the root doc to main.tex', function() { + it('should set the root doc to main.tex', function() { return this.ProjectEntityUpdateHandler.setRootDoc .calledWith(this.project_id, 'doc-id-2') .should.equal(true) @@ -433,7 +433,7 @@ describe('ProjectRootDocManager', function() { .should.equal(true) }) - return it('should set the root doc using the basename', function() { + it('should set the root doc using the basename', function() { return this.ProjectEntityUpdateHandler.setRootDoc .calledWith(this.project_id, 'doc-id-3') .should.equal(true) @@ -461,14 +461,14 @@ describe('ProjectRootDocManager', function() { .should.equal(true) }) - return it('should set the root doc to main.tex', function() { + it('should set the root doc to main.tex', function() { return this.ProjectEntityUpdateHandler.setRootDoc .calledWith(this.project_id, 'doc-id-2') .should.equal(true) }) }) - return describe('when there is no suitable root doc', function() { + describe('when there is no suitable root doc', function() { beforeEach(function(done) { this.ProjectEntityHandler.getAllDocPathsFromProjectById = sinon .stub() @@ -483,7 +483,7 @@ describe('ProjectRootDocManager', function() { ) }) - return it('should not set the root doc', function() { + it('should not set the root doc', function() { return this.ProjectEntityUpdateHandler.setRootDoc.called.should.equal( false ) @@ -523,7 +523,7 @@ describe('ProjectRootDocManager', function() { ) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -548,12 +548,12 @@ describe('ProjectRootDocManager', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) - return describe('when the project does not exist', function() { + describe('when the project does not exist', function() { beforeEach(function() { this.ProjectGetter.getProject = sinon.stub().callsArgWith(2, null, null) return this.ProjectRootDocManager.ensureRootDocumentIsSet( @@ -562,7 +562,7 @@ describe('ProjectRootDocManager', function() { ) }) - return it('should call the callback with an error', function() { + it('should call the callback with an error', function() { return this.callback .calledWith(new Error('project not found')) .should.equal(true) @@ -570,7 +570,7 @@ describe('ProjectRootDocManager', function() { }) }) - return describe('ensureRootDocumentIsValid', function() { + describe('ensureRootDocumentIsValid', function() { beforeEach(function() { this.project = {} this.ProjectGetter.getProject = sinon @@ -607,12 +607,12 @@ describe('ProjectRootDocManager', function() { ) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) - return describe('when the root doc is not valid', function() { + describe('when the root doc is not valid', function() { beforeEach(function() { this.project.rootDoc_id = 'bogus-doc-id' return this.ProjectRootDocManager.ensureRootDocumentIsValid( @@ -639,7 +639,7 @@ describe('ProjectRootDocManager', function() { ) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -665,12 +665,12 @@ describe('ProjectRootDocManager', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) - return describe('when the project does not exist', function() { + describe('when the project does not exist', function() { beforeEach(function() { this.ProjectGetter.getProject = sinon.stub().callsArgWith(2, null, null) return this.ProjectRootDocManager.ensureRootDocumentIsSet( @@ -679,7 +679,7 @@ describe('ProjectRootDocManager', function() { ) }) - return it('should call the callback with an error', function() { + it('should call the callback with an error', function() { return this.callback .calledWith(new Error('project not found')) .should.equal(true) diff --git a/services/web/test/unit/src/Project/ProjectUpdateHandlerTests.js b/services/web/test/unit/src/Project/ProjectUpdateHandlerTests.js index 7435841309..37290e9208 100644 --- a/services/web/test/unit/src/Project/ProjectUpdateHandlerTests.js +++ b/services/web/test/unit/src/Project/ProjectUpdateHandlerTests.js @@ -69,7 +69,7 @@ describe('ProjectUpdateHandler', function() { ) }) - return it('should set smart fallbacks', function(done) { + it('should set smart fallbacks', function(done) { return this.handler.markAsUpdated(this.project_id, null, null, err => { sinon.assert.calledWithMatch( this.ProjectModel.update, @@ -111,7 +111,7 @@ describe('ProjectUpdateHandler', function() { }) })) - return describe('markAsActive', () => + describe('markAsActive', () => it('should send an update to mongo', function(done) { const project_id = 'project_id' return this.handler.markAsActive(project_id, err => { diff --git a/services/web/test/unit/src/Project/SafePathTests.js b/services/web/test/unit/src/Project/SafePathTests.js index c3f9310c77..6d192cfc17 100644 --- a/services/web/test/unit/src/Project/SafePathTests.js +++ b/services/web/test/unit/src/Project/SafePathTests.js @@ -108,7 +108,7 @@ describe('SafePath', function() { // result = @SafePath.isCleanFilename 'hello.' // result.should.equal false - return it('should not accept \\', function() { + it('should not accept \\', function() { const result = this.SafePath.isCleanFilename('foo\\bar') return result.should.equal(false) }) @@ -190,7 +190,7 @@ describe('SafePath', function() { return result.should.equal(false) }) - return it('should not accept javascript property names resulting from substitutions', function() { + it('should not accept javascript property names resulting from substitutions', function() { const result = this.SafePath.isCleanPath(' proto ') return result.should.equal(false) }) @@ -208,13 +208,13 @@ describe('SafePath', function() { return result.should.equal(false) }) - return it('should not accept an empty path', function() { + it('should not accept an empty path', function() { const result = this.SafePath.isAllowedLength('') return result.should.equal(false) }) }) - return describe('clean', function() { + describe('clean', function() { it('should not modify a valid filename', function() { const result = this.SafePath.clean('main.tex') return result.should.equal('main.tex') @@ -260,7 +260,7 @@ describe('SafePath', function() { return result.should.equal('@prototype') }) - return it('should prefix javascript property names in the prototype with @', function() { + it('should prefix javascript property names in the prototype with @', function() { const result = this.SafePath.clean('hasOwnProperty') return result.should.equal('@hasOwnProperty') }) diff --git a/services/web/test/unit/src/Publishers/PublishersGetterTests.js b/services/web/test/unit/src/Publishers/PublishersGetterTests.js index cf7943d01c..c83741fdf9 100644 --- a/services/web/test/unit/src/Publishers/PublishersGetterTests.js +++ b/services/web/test/unit/src/Publishers/PublishersGetterTests.js @@ -57,7 +57,7 @@ describe('PublishersGetter', function() { return (this.userId = '12345abcde') }) - return describe('getManagedPublishers', () => + describe('getManagedPublishers', () => it('fetches v1 data before returning publisher list', function(done) { return this.PublishersGetter.getManagedPublishers(this.userId, function( error, diff --git a/services/web/test/unit/src/Referal/ReferalAllocatorTests.js b/services/web/test/unit/src/Referal/ReferalAllocatorTests.js index 315193e631..552381efe8 100644 --- a/services/web/test/unit/src/Referal/ReferalAllocatorTests.js +++ b/services/web/test/unit/src/Referal/ReferalAllocatorTests.js @@ -46,7 +46,7 @@ describe('ReferalAllocator', function() { .callsArgWith(1, null, { _id: this.user_id })) }) - return describe('allocate', function() { + describe('allocate', function() { describe('when the referal was a bonus referal', function() { beforeEach(function() { this.referal_source = 'bonus' @@ -89,7 +89,7 @@ describe('ReferalAllocator', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -122,12 +122,12 @@ describe('ReferalAllocator', function() { return this.FeaturesUpdater.refreshFeatures.called.should.equal(false) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) - return describe('when the referal is not a bonus referal', function() { + describe('when the referal is not a bonus referal', function() { beforeEach(function() { this.referal_source = 'public_share' return this.ReferalAllocator.allocate( @@ -153,7 +153,7 @@ describe('ReferalAllocator', function() { return this.FeaturesUpdater.refreshFeatures.called.should.equal(false) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) diff --git a/services/web/test/unit/src/Referal/ReferalConnectTests.js b/services/web/test/unit/src/Referal/ReferalConnectTests.js index 10aa48d832..62df253ed6 100644 --- a/services/web/test/unit/src/Referal/ReferalConnectTests.js +++ b/services/web/test/unit/src/Referal/ReferalConnectTests.js @@ -141,7 +141,7 @@ describe('Referal connect middle wear', function() { }) }) - return it('should map the collaborator invite into the session', function(done) { + it('should map the collaborator invite into the session', function(done) { const req = { query: { rs: 'ci' }, session: {} diff --git a/services/web/test/unit/src/Referal/ReferalFeaturesTests.js b/services/web/test/unit/src/Referal/ReferalFeaturesTests.js index 796bd10f00..95a28ca261 100644 --- a/services/web/test/unit/src/Referal/ReferalFeaturesTests.js +++ b/services/web/test/unit/src/Referal/ReferalFeaturesTests.js @@ -65,14 +65,14 @@ describe('ReferalFeatures', function() { .should.equal(true) }) - return it('should call the callback with the features', function() { + it('should call the callback with the features', function() { return this.callback .calledWith(null, this.Settings.bonus_features[3]) .should.equal(true) }) }) - return describe('when the user is not at a bonus level', function() { + describe('when the user is not at a bonus level', function() { beforeEach(function() { this.refered_user_count = 0 this.Settings.bonus_features = { @@ -94,7 +94,7 @@ describe('ReferalFeatures', function() { .should.equal(true) }) - return it('should call the callback with no features', function() { + it('should call the callback with no features', function() { return this.callback.calledWith(null, {}).should.equal(true) }) }) diff --git a/services/web/test/unit/src/Referal/ReferalHandlerTests.js b/services/web/test/unit/src/Referal/ReferalHandlerTests.js index e5c8a82bc8..eed7a7af8f 100644 --- a/services/web/test/unit/src/Referal/ReferalHandlerTests.js +++ b/services/web/test/unit/src/Referal/ReferalHandlerTests.js @@ -37,7 +37,7 @@ describe('Referal handler', function() { return (this.user_id = '12313') }) - return describe('getting refered user_ids', function() { + describe('getting refered user_ids', function() { it('should get the user from mongo and return the refered users array', function(done) { const user = { refered_users: ['1234', '312312', '3213129'], @@ -98,7 +98,7 @@ describe('Referal handler', function() { }) }) - return it('should return the count if it differs from the array length', function(done) { + it('should return the count if it differs from the array length', function(done) { const user = { refered_users: ['1234', '312312', '3213129'], refered_user_count: 5 diff --git a/services/web/test/unit/src/References/ReferencesControllerTests.js b/services/web/test/unit/src/References/ReferencesControllerTests.js index 74ea70b84c..7f79e0f51b 100644 --- a/services/web/test/unit/src/References/ReferencesControllerTests.js +++ b/services/web/test/unit/src/References/ReferencesControllerTests.js @@ -123,7 +123,7 @@ describe('ReferencesController', function() { }) }) - return it('should still return data', function(done) { + it('should still return data', function(done) { return this.call(() => { this.res.json.callCount.should.equal(1) this.res.json.calledWith(this.fakeResponseData).should.equal(true) @@ -132,7 +132,7 @@ describe('ReferencesController', function() { }) }) - return describe('when shouldBroadcast is false', function() { + describe('when shouldBroadcast is false', function() { beforeEach(function() { this.ReferencesHandler.index.callsArgWith( 2, @@ -158,7 +158,7 @@ describe('ReferencesController', function() { }) }) - return it('should still return data', function(done) { + it('should still return data', function(done) { return this.call(() => { this.res.json.callCount.should.equal(1) this.res.json.calledWith(this.fakeResponseData).should.equal(true) @@ -193,7 +193,7 @@ describe('ReferencesController', function() { }) }) - return it('should send a response with an empty keys list', function(done) { + it('should send a response with an empty keys list', function(done) { return this.call(() => { this.res.json.called.should.equal(true) this.res.json @@ -204,7 +204,7 @@ describe('ReferencesController', function() { }) }) - return describe('index', function() { + describe('index', function() { beforeEach(function() { return (this.call = callback => { this.controller.index(this.req, this.res) @@ -255,7 +255,7 @@ describe('ReferencesController', function() { }) }) - return describe('when ReferencesHandler.index produces an error', function() { + describe('when ReferencesHandler.index produces an error', function() { beforeEach(function() { return this.ReferencesHandler.index.callsArgWith( 2, @@ -264,7 +264,7 @@ describe('ReferencesController', function() { ) }) - return it('should produce an error response', function(done) { + it('should produce an error response', function(done) { return this.call(() => { this.res.sendStatus.callCount.should.equal(1) this.res.sendStatus.calledWith(500).should.equal(true) @@ -300,7 +300,7 @@ describe('ReferencesController', function() { }) }) - return it('should still return data', function(done) { + it('should still return data', function(done) { return this.call(() => { this.res.json.callCount.should.equal(1) this.res.json.calledWith(this.fakeResponseData).should.equal(true) @@ -322,7 +322,7 @@ describe('ReferencesController', function() { }) }) - return it('should not call ReferencesHandler.index', function(done) { + it('should not call ReferencesHandler.index', function(done) { return this.call(() => { this.ReferencesHandler.index.callCount.should.equal(0) return done() @@ -330,7 +330,7 @@ describe('ReferencesController', function() { }) }) - return describe('with invalid docIds', function() { + describe('with invalid docIds', function() { beforeEach(function() { return (this.req.body.docIds = 42) }) @@ -343,7 +343,7 @@ describe('ReferencesController', function() { }) }) - return it('should not call ReferencesHandler.index', function(done) { + it('should not call ReferencesHandler.index', function(done) { return this.call(() => { this.ReferencesHandler.index.callCount.should.equal(0) return done() diff --git a/services/web/test/unit/src/References/ReferencesHandlerTests.js b/services/web/test/unit/src/References/ReferencesHandlerTests.js index 664c812f2a..53a04c61e6 100644 --- a/services/web/test/unit/src/References/ReferencesHandlerTests.js +++ b/services/web/test/unit/src/References/ReferencesHandlerTests.js @@ -156,7 +156,7 @@ describe('ReferencesHandler', function() { }) }) - return it('should return data', function(done) { + it('should return data', function(done) { return this.call((err, data) => { expect(data).to.not.equal(null) expect(data).to.not.equal(undefined) @@ -180,7 +180,7 @@ describe('ReferencesHandler', function() { }) }) - return it('should not send request', function(done) { + it('should not send request', function(done) { return this.call((err, data) => { this.request.post.callCount.should.equal(0) return done() @@ -203,7 +203,7 @@ describe('ReferencesHandler', function() { }) }) - return it('should not send request', function(done) { + it('should not send request', function(done) { return this.call((err, data) => { this.request.post.callCount.should.equal(0) return done() @@ -230,7 +230,7 @@ describe('ReferencesHandler', function() { }) }) - return it('should not send request', function(done) { + it('should not send request', function(done) { return this.call((err, data) => { this.request.post.callCount.should.equal(0) return done() @@ -246,7 +246,7 @@ describe('ReferencesHandler', function() { return this.request.post.callsArgWith(1, new Error('woops')) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, data) => { expect(err).to.not.equal(null) expect(err).to.be.instanceof(Error) @@ -256,7 +256,7 @@ describe('ReferencesHandler', function() { }) }) - return describe('when request responds with error status', function() { + describe('when request responds with error status', function() { beforeEach(function() { this.ProjectGetter.getProject.callsArgWith(2, null, this.fakeProject) this.handler._isFullIndex.callsArgWith(1, null, false) @@ -268,7 +268,7 @@ describe('ReferencesHandler', function() { ) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, data) => { expect(err).to.not.equal(null) expect(err).to.be.instanceof(Error) @@ -363,7 +363,7 @@ describe('ReferencesHandler', function() { }) }) - return it('should not send request', function(done) { + it('should not send request', function(done) { return this.call((err, data) => { this.request.post.callCount.should.equal(0) return done() @@ -386,7 +386,7 @@ describe('ReferencesHandler', function() { }) }) - return it('should not send request', function(done) { + it('should not send request', function(done) { return this.call((err, data) => { this.request.post.callCount.should.equal(0) return done() @@ -394,7 +394,7 @@ describe('ReferencesHandler', function() { }) }) - return describe('when flushDocToMongo produces an error', function() { + describe('when flushDocToMongo produces an error', function() { beforeEach(function() { this.ProjectGetter.getProject.callsArgWith(2, null, this.fakeProject) this.handler._isFullIndex.callsArgWith(1, false) @@ -413,7 +413,7 @@ describe('ReferencesHandler', function() { }) }) - return it('should not send request', function(done) { + it('should not send request', function(done) { return this.call((err, data) => { this.request.post.callCount.should.equal(0) return done() @@ -445,7 +445,7 @@ describe('ReferencesHandler', function() { return expect(result).to.deep.equal(this.expectedIds) }) - return it('should not error with a non array of folders from dirty data', function() { + it('should not error with a non array of folders from dirty data', function() { this.fakeProject.rootFolder[0].folders[0].folders = {} const result = this.handler._findBibDocIds(this.fakeProject) return expect(result).to.deep.equal(this.expectedIds) @@ -475,13 +475,13 @@ describe('ReferencesHandler', function() { return (this.expectedIds = ['ddd', 'ghg']) }) - return it('should select the correct docIds', function() { + it('should select the correct docIds', function() { const result = this.handler._findBibFileIds(this.fakeProject) return expect(result).to.deep.equal(this.expectedIds) }) }) - return describe('_isFullIndex', function() { + describe('_isFullIndex', function() { beforeEach(function() { this.fakeProject = { owner_ref: (this.owner_ref = 'owner-ref-123') } this.owner = { @@ -503,7 +503,7 @@ describe('ReferencesHandler', function() { return (this.owner.features.references = true) }) - return it('should return true', function() { + it('should return true', function() { return this.call((err, isFullIndex) => { expect(err).to.equal(null) return expect(isFullIndex).to.equal(true) @@ -516,7 +516,7 @@ describe('ReferencesHandler', function() { return (this.owner.features.references = false) }) - return it('should return false', function() { + it('should return false', function() { return this.call((err, isFullIndex) => { expect(err).to.equal(null) return expect(isFullIndex).to.equal(false) @@ -524,7 +524,7 @@ describe('ReferencesHandler', function() { }) }) - return describe('with referencesSearch', function() { + describe('with referencesSearch', function() { beforeEach(function() { return (this.owner.features = { referencesSearch: true, @@ -532,7 +532,7 @@ describe('ReferencesHandler', function() { }) }) - return it('should return true', function() { + it('should return true', function() { return this.call((err, isFullIndex) => { expect(err).to.equal(null) return expect(isFullIndex).to.equal(true) diff --git a/services/web/test/unit/src/Security/LoginRateLimiterTests.js b/services/web/test/unit/src/Security/LoginRateLimiterTests.js index ece9997fa6..3b0affe3b8 100644 --- a/services/web/test/unit/src/Security/LoginRateLimiterTests.js +++ b/services/web/test/unit/src/Security/LoginRateLimiterTests.js @@ -64,7 +64,7 @@ describe('LoginRateLimiter', function() { .callsArgWith(1, null, true)) }) - return it('should call pass allow=true', function(done) { + it('should call pass allow=true', function(done) { return this.LoginRateLimiter.processLoginRequest( this.email, (err, allow) => { @@ -83,7 +83,7 @@ describe('LoginRateLimiter', function() { .callsArgWith(1, null, false)) }) - return it('should call pass allow=false', function(done) { + it('should call pass allow=false', function(done) { return this.LoginRateLimiter.processLoginRequest( this.email, (err, allow) => { @@ -95,14 +95,14 @@ describe('LoginRateLimiter', function() { }) }) - return describe('when addCount produces an error', function() { + describe('when addCount produces an error', function() { beforeEach(function() { return (this.RateLimiter.addCount = sinon .stub() .callsArgWith(1, new Error('woops'))) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.LoginRateLimiter.processLoginRequest( this.email, (err, allow) => { @@ -115,14 +115,14 @@ describe('LoginRateLimiter', function() { }) }) - return describe('recordSuccessfulLogin', function() { + describe('recordSuccessfulLogin', function() { beforeEach(function() { return (this.RateLimiter.clearRateLimit = sinon .stub() .callsArgWith(2, null)) }) - return it('should call clearRateLimit', function(done) { + it('should call clearRateLimit', function(done) { return this.LoginRateLimiter.recordSuccessfulLogin(this.email, () => { this.RateLimiter.clearRateLimit.callCount.should.equal(1) this.RateLimiter.clearRateLimit diff --git a/services/web/test/unit/src/Security/OneTimeTokenHandlerTests.js b/services/web/test/unit/src/Security/OneTimeTokenHandlerTests.js index 5574660d8d..b8d95c20d4 100644 --- a/services/web/test/unit/src/Security/OneTimeTokenHandlerTests.js +++ b/services/web/test/unit/src/Security/OneTimeTokenHandlerTests.js @@ -73,14 +73,14 @@ describe('OneTimeTokenHandler', function() { .should.equal(true) }) - return it('should call the callback with the token', function() { + it('should call the callback with the token', function() { return this.callback .calledWith(null, this.stubbedToken) .should.equal(true) }) }) - return describe('with an optional expiresIn parameter', function() { + describe('with an optional expiresIn parameter', function() { beforeEach(function() { return this.OneTimeTokenHandler.getNewToken( 'password', @@ -102,7 +102,7 @@ describe('OneTimeTokenHandler', function() { .should.equal(true) }) - return it('should call the callback with the token', function() { + it('should call the callback with the token', function() { return this.callback .calledWith(null, this.stubbedToken) .should.equal(true) @@ -110,7 +110,7 @@ describe('OneTimeTokenHandler', function() { }) }) - return describe('getValueFromTokenAndExpire', function() { + describe('getValueFromTokenAndExpire', function() { describe('successfully', function() { beforeEach(function() { this.db.tokens.findAndModify = sinon @@ -139,12 +139,12 @@ describe('OneTimeTokenHandler', function() { .should.equal(true) }) - return it('should return the data', function() { + it('should return the data', function() { return this.callback.calledWith(null, 'mock-data').should.equal(true) }) }) - return describe('when a valid token is not found', function() { + describe('when a valid token is not found', function() { beforeEach(function() { this.db.tokens.findAndModify = sinon.stub().yields(null, null) return this.OneTimeTokenHandler.getValueFromTokenAndExpire( @@ -154,7 +154,7 @@ describe('OneTimeTokenHandler', function() { ) }) - return it('should return a NotFoundError', function() { + it('should return a NotFoundError', function() { return this.callback .calledWith(sinon.match.instanceOf(Errors.NotFoundError)) .should.equal(true) diff --git a/services/web/test/unit/src/Security/RateLimiterMiddlewareTests.js b/services/web/test/unit/src/Security/RateLimiterMiddlewareTests.js index 2a7f5a16dd..9a7a06be73 100644 --- a/services/web/test/unit/src/Security/RateLimiterMiddlewareTests.js +++ b/services/web/test/unit/src/Security/RateLimiterMiddlewareTests.js @@ -49,7 +49,7 @@ describe('RateLimiterMiddleware', function() { return (this.next = sinon.stub()) }) - return describe('rateLimit', function() { + describe('rateLimit', function() { beforeEach(function() { this.rateLimiter = this.RateLimiterMiddleware.rateLimit({ endpointName: 'test-endpoint', @@ -81,7 +81,7 @@ describe('RateLimiterMiddleware', function() { .should.equal(true) }) - return it('should pass on to next()', function() {}) + it('should pass on to next()', function() {}) }) describe('when under the rate limit with logged in user', function() { @@ -106,7 +106,7 @@ describe('RateLimiterMiddleware', function() { .should.equal(true) }) - return it('should pass on to next()', function() { + it('should pass on to next()', function() { return this.next.called.should.equal(true) }) }) @@ -129,12 +129,12 @@ describe('RateLimiterMiddleware', function() { .should.equal(true) }) - return it('should pass on to next()', function() { + it('should pass on to next()', function() { return this.next.called.should.equal(true) }) }) - return describe('when over the rate limit', function() { + describe('when over the rate limit', function() { beforeEach(function() { this.req.session = { user: { @@ -154,7 +154,7 @@ describe('RateLimiterMiddleware', function() { return this.next.called.should.equal(false) }) - return it('should log a warning', function() { + it('should log a warning', function() { return this.logger.warn .calledWith( { diff --git a/services/web/test/unit/src/Subscription/FeaturesUpdaterTests.js b/services/web/test/unit/src/Subscription/FeaturesUpdaterTests.js index 8593085eca..b6b6581ffb 100644 --- a/services/web/test/unit/src/Subscription/FeaturesUpdaterTests.js +++ b/services/web/test/unit/src/Subscription/FeaturesUpdaterTests.js @@ -144,7 +144,7 @@ describe('FeaturesUpdater', function() { }) }) - return describe('_mergeFeatures', function() { + describe('_mergeFeatures', function() { it('should prefer priority over standard for compileGroup', function() { expect( this.FeaturesUpdater._mergeFeatures( @@ -262,7 +262,7 @@ describe('FeaturesUpdater', function() { }) }) - return it('should prefer the true over false for other keys', function() { + it('should prefer the true over false for other keys', function() { expect( this.FeaturesUpdater._mergeFeatures( { diff --git a/services/web/test/unit/src/Subscription/LimitationsManagerTests.js b/services/web/test/unit/src/Subscription/LimitationsManagerTests.js index a8019590df..e2f4d6ff4f 100644 --- a/services/web/test/unit/src/Subscription/LimitationsManagerTests.js +++ b/services/web/test/unit/src/Subscription/LimitationsManagerTests.js @@ -78,14 +78,14 @@ describe('LimitationsManager', function() { ) }) - return it('should return the default number', function() { + it('should return the default number', function() { return this.callback .calledWith(null, this.Settings.defaultFeatures.collaborators) .should.equal(true) }) }) - return describe('when the project is owned by a user with a subscription', function() { + describe('when the project is owned by a user with a subscription', function() { beforeEach(function() { this.project.owner_ref = this.user_id this.user.features = { collaborators: 21 } @@ -96,7 +96,7 @@ describe('LimitationsManager', function() { ) }) - return it('should return the number of collaborators the user is allowed', function() { + it('should return the number of collaborators the user is allowed', function() { return this.callback .calledWith(null, this.user.features.collaborators) .should.equal(true) @@ -116,14 +116,14 @@ describe('LimitationsManager', function() { ) }) - return it('should return the default number', function() { + it('should return the default number', function() { return this.callback .calledWith(null, this.Settings.defaultFeatures.collaborators) .should.equal(true) }) }) - return describe('when the user has features', function() { + describe('when the user has features', function() { beforeEach(function() { this.user.features = { collaborators: 21 } this.callback = sinon.stub() @@ -133,7 +133,7 @@ describe('LimitationsManager', function() { ) }) - return it('should return the number of collaborators the user is allowed', function() { + it('should return the number of collaborators the user is allowed', function() { return this.callback .calledWith(null, this.user.features.collaborators) .should.equal(true) @@ -170,7 +170,7 @@ describe('LimitationsManager', function() { ) }) - return it('should return true', function() { + it('should return true', function() { return this.callback.calledWith(null, true).should.equal(true) }) }) @@ -203,7 +203,7 @@ describe('LimitationsManager', function() { ) }) - return it('should return true', function() { + it('should return true', function() { return this.callback.calledWith(null, true).should.equal(true) }) }) @@ -236,7 +236,7 @@ describe('LimitationsManager', function() { ) }) - return it('should return false', function() { + it('should return false', function() { return this.callback.calledWith(null, false).should.equal(true) }) }) @@ -269,7 +269,7 @@ describe('LimitationsManager', function() { ) }) - return it('should return false', function() { + it('should return false', function() { return this.callback.calledWith(null, false).should.equal(true) }) }) @@ -302,7 +302,7 @@ describe('LimitationsManager', function() { ) }) - return it('should return true', function() { + it('should return true', function() { return this.callback.calledWith(null, true).should.equal(true) }) }) @@ -335,12 +335,12 @@ describe('LimitationsManager', function() { ) }) - return it('should return false', function() { + it('should return false', function() { return this.callback.calledWith(null, false).should.equal(true) }) }) - return describe('when the project has more invites and collaborators than allowed', function() { + describe('when the project has more invites and collaborators than allowed', function() { beforeEach(function() { this.current_number = 1 this.allowed_number = 2 @@ -368,7 +368,7 @@ describe('LimitationsManager', function() { ) }) - return it('should return false', function() { + it('should return false', function() { return this.callback.calledWith(null, false).should.equal(true) }) }) @@ -432,7 +432,7 @@ describe('LimitationsManager', function() { }) }) - return describe('when user has a custom account', function() { + describe('when user has a custom account', function() { beforeEach(function() { this.fakeSubscription = { customAccount: true } return this.SubscriptionLocator.getUsersSubscription.callsArgWith( @@ -452,7 +452,7 @@ describe('LimitationsManager', function() { ) }) - return it('should return the subscription', function(done) { + it('should return the subscription', function(done) { return this.LimitationsManager.userHasV2Subscription( this.user, (err, hasSubscription, subscription) => { @@ -480,7 +480,7 @@ describe('LimitationsManager', function() { ) }) - return it('should return true if there are no groups subcriptions', function(done) { + it('should return true if there are no groups subcriptions', function(done) { let subscriptions this.SubscriptionLocator.getMemberSubscriptions.callsArgWith( 1, @@ -560,7 +560,7 @@ describe('LimitationsManager', function() { }) }) - return it('should have userHasSubscriptionOrIsGroupMember alias', function(done) { + it('should have userHasSubscriptionOrIsGroupMember alias', function(done) { return this.LimitationsManager.userHasSubscriptionOrIsGroupMember( this.user, function(err, hasSubOrIsGroupMember) { @@ -607,7 +607,7 @@ describe('LimitationsManager', function() { ) }) - return it('should return false if none are true', function(done) { + it('should return false if none are true', function(done) { return this.LimitationsManager.userHasV1OrV2Subscription( this.user, function(err, hasSub) { @@ -661,7 +661,7 @@ describe('LimitationsManager', function() { ) }) - return it('should return true if the limit has been exceded (including members and invites)', function(done) { + it('should return true if the limit has been exceded (including members and invites)', function(done) { this.subscription.membersLimit = 2 this.SubscriptionLocator.getSubscription.callsArgWith( 1, @@ -678,7 +678,7 @@ describe('LimitationsManager', function() { }) }) - return describe('userHasV1Subscription', function() { + describe('userHasV1Subscription', function() { it('should return true if v1 returns has_subscription = true', function(done) { this.V1SubscriptionManager.getSubscriptionsFromV1 = sinon .stub() @@ -711,7 +711,7 @@ describe('LimitationsManager', function() { ) }) - return it('should return false if v1 returns nothing', function(done) { + it('should return false if v1 returns nothing', function(done) { this.V1SubscriptionManager.getSubscriptionsFromV1 = sinon .stub() .yields(null, null) diff --git a/services/web/test/unit/src/Subscription/RecurlyWrapperTests.js b/services/web/test/unit/src/Subscription/RecurlyWrapperTests.js index d9aefcc48b..188235f4fd 100644 --- a/services/web/test/unit/src/Subscription/RecurlyWrapperTests.js +++ b/services/web/test/unit/src/Subscription/RecurlyWrapperTests.js @@ -185,7 +185,7 @@ describe('RecurlyWrapper', function() { ) }) - return it('should return the subscription', function() { + it('should return the subscription', function() { return this.recurlySubscription.uuid.should.equal( '44f83d7cba354d5b84812419f923ea96' ) @@ -217,14 +217,14 @@ describe('RecurlyWrapper', function() { ) }) - return it('should look up the subscription at the RecurlyJS API end point', function() { + it('should look up the subscription at the RecurlyJS API end point', function() { return this.apiRequest.args[0][0].url.should.equal( 'recurly_js/result/70db44b10f5f4b238669480c9903f6f5' ) }) }) - return describe('with includeAccount', function() { + describe('with includeAccount', function() { beforeEach(function() { this.apiRequest = sinon.stub( this.RecurlyWrapper, @@ -247,7 +247,7 @@ describe('RecurlyWrapper', function() { return this.apiRequest.args[1][0].url.should.equal('accounts/104') }) - return it('should populate the account attribute', function() { + it('should populate the account attribute', function() { return this.recurlySubscription.account.account_code.should.equal('104') }) }) @@ -296,7 +296,7 @@ describe('RecurlyWrapper', function() { return this.requestOptions.method.should.equal('put') }) - return it('should return the updated subscription', function() { + it('should return the updated subscription', function() { should.exist(this.recurlySubscription) return this.recurlySubscription.plan.plan_code.should.equal('gold') }) @@ -330,7 +330,7 @@ describe('RecurlyWrapper', function() { return this.apiRequest.called.should.equal(true) }) - return describe('when the subscription is already cancelled', function() { + describe('when the subscription is already cancelled', function() { beforeEach(function() { this.RecurlyWrapper.apiRequest.restore() this.recurlySubscriptionId = 'subscription-id-123' @@ -347,7 +347,7 @@ describe('RecurlyWrapper', function() { )) }) - return it('should not produce an error', function(done) { + it('should not produce an error', function(done) { return this.RecurlyWrapper.cancelSubscription( this.recurlySubscriptionId, err => { @@ -383,7 +383,7 @@ describe('RecurlyWrapper', function() { return this.RecurlyWrapper.apiRequest.restore() }) - return it('should send a cancel request to the API', function() { + it('should send a cancel request to the API', function() { return this.apiRequest.called.should.equal(true) }) }) @@ -412,7 +412,7 @@ describe('RecurlyWrapper', function() { return this.RecurlyWrapper.apiRequest.restore() }) - return it('sends correct XML', function() { + it('sends correct XML', function() { this.apiRequest.called.should.equal(true) const { body } = this.apiRequest.lastCall.args[0] return expect(body).to.equal(`\ @@ -452,7 +452,7 @@ describe('RecurlyWrapper', function() { return this.RecurlyWrapper.apiRequest.restore() }) - return it('sends correct XML', function() { + it('sends correct XML', function() { this.apiRequest.called.should.equal(true) const { body } = this.apiRequest.lastCall.args[0] return expect(body).to.equal(`\ @@ -543,7 +543,7 @@ describe('RecurlyWrapper', function() { }) }) - return describe('when _createPaypalSubscription produces an error', function() { + describe('when _createPaypalSubscription produces an error', function() { beforeEach(function() { return this._createPaypalSubscription.callsArgWith( 3, @@ -551,7 +551,7 @@ describe('RecurlyWrapper', function() { ) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, sub) => { expect(err).to.be.instanceof(Error) return done() @@ -560,7 +560,7 @@ describe('RecurlyWrapper', function() { }) }) - return describe('when not paypal', function() { + describe('when not paypal', function() { beforeEach(function() { this.subscriptionDetails.isPaypal = false this._createCreditCardSubscription = sinon.stub( @@ -600,7 +600,7 @@ describe('RecurlyWrapper', function() { }) }) - return describe('when _createCreditCardSubscription produces an error', function() { + describe('when _createCreditCardSubscription produces an error', function() { beforeEach(function() { return this._createCreditCardSubscription.callsArgWith( 3, @@ -608,7 +608,7 @@ describe('RecurlyWrapper', function() { ) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, sub) => { expect(err).to.be.instanceof(Error) return done() @@ -737,7 +737,7 @@ describe('RecurlyWrapper', function() { }) }) - return it('should not _parseSubscriptionXml', function(done) { + it('should not _parseSubscriptionXml', function(done) { return this.call((err, sub) => { this._parseSubscriptionXml.callCount.should.equal(0) return done() @@ -745,12 +745,12 @@ describe('RecurlyWrapper', function() { }) }) - return describe('when parse xml produces an error', function() { + describe('when parse xml produces an error', function() { beforeEach(function() { return this._parseSubscriptionXml.callsArgWith(1, new Error('woops')) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, sub) => { expect(err).to.be.instanceof(Error) return done() @@ -887,7 +887,7 @@ describe('RecurlyWrapper', function() { }) }) - return describe('when one of the paypal stages produces an error', function() { + describe('when one of the paypal stages produces an error', function() { beforeEach(function() { return this.createAccount.callsArgWith(1, new Error('woops')) }) @@ -899,7 +899,7 @@ describe('RecurlyWrapper', function() { }) }) - return it('should stop calling the paypal stages after the error', function(done) { + it('should stop calling the paypal stages after the error', function(done) { return this.call((err, sub) => { this.checkAccountExists.callCount.should.equal(1) this.createAccount.callCount.should.equal(1) @@ -1010,7 +1010,7 @@ describe('RecurlyWrapper', function() { }) }) - return it('should set userExists to true', function(done) { + it('should set userExists to true', function(done) { return this.call((err, result) => { expect(result.userExists).to.equal(true) return done() @@ -1052,7 +1052,7 @@ describe('RecurlyWrapper', function() { }) }) - return it('should set userExists to false', function(done) { + it('should set userExists to false', function(done) { return this.call((err, result) => { expect(result.userExists).to.equal(false) return done() @@ -1060,14 +1060,14 @@ describe('RecurlyWrapper', function() { }) }) - return describe('when apiRequest produces an error', function() { + describe('when apiRequest produces an error', function() { beforeEach(function() { return this.apiRequest.callsArgWith(1, new Error('woops'), { statusCode: 500 }) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() @@ -1088,7 +1088,7 @@ describe('RecurlyWrapper', function() { return (this.cache.subscriptionDetails.address = null) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() @@ -1126,7 +1126,7 @@ describe('RecurlyWrapper', function() { }) }) - return it('should not call _parseAccountXml', function(done) { + it('should not call _parseAccountXml', function(done) { return this.call((err, result) => { this.RecurlyWrapper._parseAccountXml.callCount.should.equal(0) return done() @@ -1134,7 +1134,7 @@ describe('RecurlyWrapper', function() { }) }) - return describe('when account does not exist', function() { + describe('when account does not exist', function() { beforeEach(function() { this.cache.userExists = false const resultXml = @@ -1192,14 +1192,14 @@ describe('RecurlyWrapper', function() { }) }) - return describe('when apiRequest produces an error', function() { + describe('when apiRequest produces an error', function() { beforeEach(function() { return this.apiRequest.callsArgWith(1, new Error('woops'), { statusCode: 500 }) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() @@ -1225,7 +1225,7 @@ describe('RecurlyWrapper', function() { return (this.cache.account.account_code = null) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() @@ -1278,7 +1278,7 @@ describe('RecurlyWrapper', function() { }) }) - return it('should set billingInfo on cache', function(done) { + it('should set billingInfo on cache', function(done) { return this.call((err, result) => { expect(result.billingInfo).to.deep.equal({ a: '1' @@ -1288,14 +1288,14 @@ describe('RecurlyWrapper', function() { }) }) - return describe('when apiRequest produces an error', function() { + describe('when apiRequest produces an error', function() { beforeEach(function() { return this.apiRequest.callsArgWith(1, new Error('woops'), { statusCode: 500 }) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() @@ -1318,7 +1318,7 @@ describe('RecurlyWrapper', function() { return (this.cache.account.account_code = null) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() @@ -1331,7 +1331,7 @@ describe('RecurlyWrapper', function() { return (this.cache.subscriptionDetails.address = null) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() @@ -1389,7 +1389,7 @@ describe('RecurlyWrapper', function() { }) }) - return it('should set billingInfo on cache', function(done) { + it('should set billingInfo on cache', function(done) { return this.call((err, result) => { expect(result.billingInfo).to.deep.equal({ city: 'London' @@ -1399,14 +1399,14 @@ describe('RecurlyWrapper', function() { }) }) - return describe('when apiRequest produces an error', function() { + describe('when apiRequest produces an error', function() { beforeEach(function() { return this.apiRequest.callsArgWith(1, new Error('woops'), { statusCode: 500 }) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() @@ -1415,7 +1415,7 @@ describe('RecurlyWrapper', function() { }) }) - return describe('_paypal.createSubscription', function() { + describe('_paypal.createSubscription', function() { beforeEach(function() { this.cache.account = { account_code: 'abc' } this.cache.billingInfo = {} @@ -1477,7 +1477,7 @@ describe('RecurlyWrapper', function() { }) }) - return it('should set subscription on cache', function(done) { + it('should set subscription on cache', function(done) { return this.call((err, result) => { expect(result.subscription).to.deep.equal({ a: '1' @@ -1487,14 +1487,14 @@ describe('RecurlyWrapper', function() { }) }) - return describe('when apiRequest produces an error', function() { + describe('when apiRequest produces an error', function() { beforeEach(function() { return this.apiRequest.callsArgWith(1, new Error('woops'), { statusCode: 500 }) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, result) => { expect(err).to.be.instanceof(Error) return done() @@ -1504,7 +1504,7 @@ describe('RecurlyWrapper', function() { }) }) - return describe('listAccountActiveSubscriptions', function() { + describe('listAccountActiveSubscriptions', function() { beforeEach(function() { this.user_id = 'mock-user-id' this.callback = sinon.stub() @@ -1540,14 +1540,14 @@ describe('RecurlyWrapper', function() { .should.equal(true) }) - return it('should return the subscriptions', function() { + it('should return the subscriptions', function() { return this.callback .calledWith(null, this.subscriptions) .should.equal(true) }) }) - return describe('without an account', function() { + describe('without an account', function() { beforeEach(function() { this.response.statusCode = 404 return this.RecurlyWrapper.listAccountActiveSubscriptions( @@ -1556,7 +1556,7 @@ describe('RecurlyWrapper', function() { ) }) - return it('should return an empty array of subscriptions', function() { + it('should return an empty array of subscriptions', function() { return this.callback.calledWith(null, []).should.equal(true) }) }) diff --git a/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js b/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js index 415020e3df..21ff137bfd 100644 --- a/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js +++ b/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js @@ -140,7 +140,7 @@ describe('SubscriptionController', function() { return done() }) - return describe('not dependant on logged in state', function(done) { + describe('not dependant on logged in state', function(done) { // these could have been put in 'when user is not logged in' too it('should set the recommended currency from the geoiplookup', function(done) { this.res.renderedVariables.recomendedCurrency.should.equal( @@ -151,14 +151,14 @@ describe('SubscriptionController', function() { .should.equal(true) return done() }) - return it('should include data for features table', function(done) { + it('should include data for features table', function(done) { this.res.renderedVariables.planFeatures.length.should.not.equal(0) return done() }) }) }) - return describe('when user is not logged in', function(done) { + describe('when user is not logged in', function(done) { beforeEach(function(done) { this.res.callback = done this.AuthenticationController.getLoggedInUserId = sinon @@ -167,7 +167,7 @@ describe('SubscriptionController', function() { return this.SubscriptionController.plansPage(this.req, this.res) }) - return it('should not fetch the current user', function(done) { + it('should not fetch the current user', function(done) { this.UserGetter.getUser.callCount.should.equal(0) return done() }) @@ -197,7 +197,7 @@ describe('SubscriptionController', function() { return this.PlansLocator.findLocalPlanInSettings.returns({}) }) - return describe('with a valid plan code', () => + describe('with a valid plan code', () => it('should render the new subscription page', function(done) { this.res.render = (page, opts) => { page.should.equal('subscriptions/new') @@ -265,7 +265,7 @@ describe('SubscriptionController', function() { return this.SubscriptionController.paymentPage(this.req, this.res) }) - return it('should use the geo ip currency if non is provided', function(done) { + it('should use the geo ip currency if non is provided', function(done) { this.req.query.currency = null this.res.render = (page, opts) => { opts.currency.should.equal(this.stubbedCurrencyCode) @@ -275,7 +275,7 @@ describe('SubscriptionController', function() { }) }) - return describe('with a recurly subscription already', () => + describe('with a recurly subscription already', () => it('should redirect to the subscription dashboard', function(done) { this.LimitationsManager.userHasV1OrV2Subscription.callsArgWith( 1, @@ -353,7 +353,7 @@ describe('SubscriptionController', function() { return expect(this.data.user).to.deep.equal(this.user) }) - return it('should load the plans', function() { + it('should load the plans', function() { return expect(this.data.plans).to.deep.equal(this.plans) }) }) @@ -387,7 +387,7 @@ describe('SubscriptionController', function() { return done() }) - return it('should redurect to the subscription page', function(done) { + it('should redurect to the subscription page', function(done) { this.res.sendStatus.calledWith(201).should.equal(true) return done() }) @@ -413,7 +413,7 @@ describe('SubscriptionController', function() { return done() }) - return it('should redurect to the subscription page', function(done) { + it('should redurect to the subscription page', function(done) { this.res.redirect.calledWith('/user/subscription').should.equal(true) return done() }) @@ -440,7 +440,7 @@ describe('SubscriptionController', function() { return done() }) - return it('should redurect to the subscription page', function(done) { + it('should redurect to the subscription page', function(done) { this.res.redirect.calledWith('/user/subscription').should.equal(true) return done() }) @@ -464,7 +464,7 @@ describe('SubscriptionController', function() { return done() }) - return it('should redurect to the subscription page', function(done) { + it('should redurect to the subscription page', function(done) { this.res.redirect .calledWith('/user/subscription/canceled') .should.equal(true) @@ -498,13 +498,13 @@ describe('SubscriptionController', function() { return done() }) - return it('should send a 200', function(done) { + it('should send a 200', function(done) { this.res.sendStatus.calledWith(200) return done() }) }) - return describe('with a non-actionable request', function() { + describe('with a non-actionable request', function() { beforeEach(function(done) { this.user.id = this.activeRecurlySubscription.account.account_code this.req = { @@ -531,7 +531,7 @@ describe('SubscriptionController', function() { ) }) - return it('should respond with a 200 status', function() { + it('should respond with a 200 status', function() { return this.res.sendStatus.calledWith(200) }) }) @@ -585,7 +585,7 @@ describe('SubscriptionController', function() { ) }) - return it('should pass annual as the plan name if the user is already on an annual plan', function(done) { + it('should pass annual as the plan name if the user is already on an annual plan', function(done) { this.LimitationsManager.userHasV2Subscription.callsArgWith( 1, null, @@ -603,7 +603,7 @@ describe('SubscriptionController', function() { }) }) - return describe('processUpgradeToAnnualPlan', function() { + describe('processUpgradeToAnnualPlan', function() { beforeEach(function() {}) it('should tell the subscription handler to update the subscription with the annual plan and apply a coupon code', function(done) { @@ -622,7 +622,7 @@ describe('SubscriptionController', function() { ) }) - return it('should get the collaborator coupon code', function(done) { + it('should get the collaborator coupon code', function(done) { this.req.body = { planName: 'collaborator' } this.res.sendStatus = url => { diff --git a/services/web/test/unit/src/Subscription/SubscriptionGroupControllerTests.js b/services/web/test/unit/src/Subscription/SubscriptionGroupControllerTests.js index 437e84b900..5595c730a6 100644 --- a/services/web/test/unit/src/Subscription/SubscriptionGroupControllerTests.js +++ b/services/web/test/unit/src/Subscription/SubscriptionGroupControllerTests.js @@ -71,7 +71,7 @@ describe('SubscriptionGroupController', function() { })) }) - return describe('removeUserFromGroup', () => + describe('removeUserFromGroup', () => it('should use the subscription id for the logged in user and take the user id from the params', function(done) { const userIdToRemove = '31231' this.req.params = { user_id: userIdToRemove } diff --git a/services/web/test/unit/src/Subscription/SubscriptionGroupHandlerTests.js b/services/web/test/unit/src/Subscription/SubscriptionGroupHandlerTests.js index 85e01e3b59..9781f1dd5d 100644 --- a/services/web/test/unit/src/Subscription/SubscriptionGroupHandlerTests.js +++ b/services/web/test/unit/src/Subscription/SubscriptionGroupHandlerTests.js @@ -162,7 +162,7 @@ describe('SubscriptionGroupHandler', function() { .should.equal(true) }) - return it('replaces the member ids', function() { + it('replaces the member ids', function() { this.Subscription.update .calledWith( { member_ids: this.oldId }, @@ -200,7 +200,7 @@ describe('SubscriptionGroupHandler', function() { ) }) - return it('should return false when no subscription is found', function(done) { + it('should return false when no subscription is found', function(done) { this.SubscriptionLocator.getSubscriptionByMemberIdAndId.callsArgWith( 2, null @@ -216,12 +216,12 @@ describe('SubscriptionGroupHandler', function() { }) }) - return describe('getTotalConfirmedUsersInGroup', function() { + describe('getTotalConfirmedUsersInGroup', function() { describe('for existing subscriptions', function() { beforeEach(function() { return (this.subscription.member_ids = ['12321', '3121321']) }) - return it('should call the subscription locator and return 2 users', function(done) { + it('should call the subscription locator and return 2 users', function(done) { return this.Handler.getTotalConfirmedUsersInGroup( this.subscription_id, (err, count) => { @@ -234,7 +234,7 @@ describe('SubscriptionGroupHandler', function() { ) }) }) - return describe('for nonexistent subscriptions', () => + describe('for nonexistent subscriptions', () => it('should return undefined', function(done) { return this.Handler.getTotalConfirmedUsersInGroup( 'fake-id', diff --git a/services/web/test/unit/src/Subscription/SubscriptionHandlerTests.js b/services/web/test/unit/src/Subscription/SubscriptionHandlerTests.js index 0e1e542364..1004a74da9 100644 --- a/services/web/test/unit/src/Subscription/SubscriptionHandlerTests.js +++ b/services/web/test/unit/src/Subscription/SubscriptionHandlerTests.js @@ -141,7 +141,7 @@ describe('SubscriptionHandler', function() { .should.equal(true) }) - return it('should sync the subscription to the user', function() { + it('should sync the subscription to the user', function() { this.SubscriptionUpdater.syncSubscription.calledOnce.should.equal(true) this.SubscriptionUpdater.syncSubscription.args[0][0].should.deep.equal( this.activeRecurlySubscription @@ -152,7 +152,7 @@ describe('SubscriptionHandler', function() { }) }) - return describe('when there is already a subscription in Recurly', function() { + describe('when there is already a subscription in Recurly', function() { beforeEach(function() { this.SubscriptionHandler.validateNoSubscriptionInRecurly = sinon .stub() @@ -165,7 +165,7 @@ describe('SubscriptionHandler', function() { ) }) - return it('should return an error', function() { + it('should return an error', function() { return this.callback.calledWith( new Error('user already has subscription in recurly') ) @@ -207,7 +207,7 @@ describe('SubscriptionHandler', function() { return updateOptions.timeframe.should.equal('now') }) - return it('should sync the new subscription to the user', function() { + it('should sync the new subscription to the user', function() { this.SubscriptionUpdater.syncSubscription.calledOnce.should.equal( true ) @@ -235,7 +235,7 @@ describe('SubscriptionHandler', function() { ) }) - return it('should redirect to the subscription dashboard', function() { + it('should redirect to the subscription dashboard', function() { this.RecurlyWrapper.updateSubscription.called.should.equal(false) return this.SubscriptionHandler.syncSubscriptionToUser.called.should.equal( false @@ -243,7 +243,7 @@ describe('SubscriptionHandler', function() { }) }) - return describe('with a coupon code', function() { + describe('with a coupon code', function() { beforeEach(function(done) { this.plan_code = 'collaborator' this.coupon_code = '1231312' @@ -277,7 +277,7 @@ describe('SubscriptionHandler', function() { return done() }) - return it('should update the subscription', function() { + it('should update the subscription', function() { this.RecurlyWrapper.updateSubscription .calledWith(this.subscription.recurlySubscription_id) .should.equal(true) @@ -299,12 +299,12 @@ describe('SubscriptionHandler', function() { return this.SubscriptionHandler.cancelSubscription(this.user, done) }) - return it('should redirect to the subscription dashboard', function() { + it('should redirect to the subscription dashboard', function() { return this.RecurlyWrapper.cancelSubscription.called.should.equal(false) }) }) - return describe('with a user with a subscription', function() { + describe('with a user with a subscription', function() { beforeEach(function(done) { this.LimitationsManager.userHasV2Subscription.callsArgWith( 1, @@ -322,7 +322,7 @@ describe('SubscriptionHandler', function() { .should.equal(true) }) - return it('should trigger the cancel subscription event', function() { + it('should trigger the cancel subscription event', function() { return this.Events.emit .calledWith('cancelSubscription', this.user._id) .should.equal(true) @@ -348,12 +348,12 @@ describe('SubscriptionHandler', function() { ) }) - return it('should not send a notification email', function() { + it('should not send a notification email', function() { return sinon.assert.notCalled(this.EmailHandler.sendEmail) }) }) - return describe('with a user with a subscription', function() { + describe('with a user with a subscription', function() { beforeEach(function(done) { this.LimitationsManager.userHasV2Subscription.callsArgWith( 1, @@ -371,7 +371,7 @@ describe('SubscriptionHandler', function() { .should.equal(true) }) - return it('should send a notification email', function() { + it('should send a notification email', function() { return sinon.assert.calledWith( this.EmailHandler.sendEmail, 'reactivatedSubscription' @@ -406,7 +406,7 @@ describe('SubscriptionHandler', function() { return options.includeAccount.should.equal(true) }) - return it('should sync the subscription to the user', function() { + it('should sync the subscription to the user', function() { this.SubscriptionUpdater.syncSubscription.calledOnce.should.equal(true) this.SubscriptionUpdater.syncSubscription.args[0][0].should.deep.equal( this.activeRecurlySubscription @@ -417,7 +417,7 @@ describe('SubscriptionHandler', function() { }) })) - return describe('validateNoSubscriptionInRecurly', function() { + describe('validateNoSubscriptionInRecurly', function() { beforeEach(function() { this.subscriptions = [] this.RecurlyWrapper.listAccountActiveSubscriptions = sinon @@ -448,12 +448,12 @@ describe('SubscriptionHandler', function() { .should.equal(true) }) - return it('should call the callback with valid == false', function() { + it('should call the callback with valid == false', function() { return this.callback.calledWith(null, false).should.equal(true) }) }) - return describe('with a subscription in recurly', function() { + describe('with a subscription in recurly', function() { beforeEach(function() { return this.SubscriptionHandler.validateNoSubscriptionInRecurly( this.user_id, @@ -467,7 +467,7 @@ describe('SubscriptionHandler', function() { ) }) - return it('should call the callback with valid == true', function() { + it('should call the callback with valid == true', function() { return this.callback.calledWith(null, true).should.equal(true) }) }) diff --git a/services/web/test/unit/src/Subscription/SubscriptionLocatorTests.js b/services/web/test/unit/src/Subscription/SubscriptionLocatorTests.js index a0c78ae321..f5665c1d48 100644 --- a/services/web/test/unit/src/Subscription/SubscriptionLocatorTests.js +++ b/services/web/test/unit/src/Subscription/SubscriptionLocatorTests.js @@ -39,7 +39,7 @@ describe('Subscription Locator Tests', function() { })) }) - return describe('finding users subscription', function() { + describe('finding users subscription', function() { it('should send the users features', function(done) { this.Subscription.findOne.callsArgWith(1, null, this.subscription) return this.SubscriptionLocator.getUsersSubscription( @@ -79,7 +79,7 @@ describe('Subscription Locator Tests', function() { ) }) - return describe('finding managed subscription', () => + describe('finding managed subscription', () => it('should query the database', function(done) { this.Subscription.findOne.callsArgWith(1, null, this.subscription) return this.SubscriptionLocator.findManagedSubscription( diff --git a/services/web/test/unit/src/Subscription/UserFeaturesUpdaterTests.js b/services/web/test/unit/src/Subscription/UserFeaturesUpdaterTests.js index f9e921088a..dd1dd645cb 100644 --- a/services/web/test/unit/src/Subscription/UserFeaturesUpdaterTests.js +++ b/services/web/test/unit/src/Subscription/UserFeaturesUpdaterTests.js @@ -34,7 +34,7 @@ describe('UserFeaturesUpdater', function() { })) }) - return describe('updateFeatures', () => + describe('updateFeatures', () => it('should send the users features', function(done) { const user_id = '5208dd34438842e2db000005' this.features = { versioning: true, collaborators: 10 } diff --git a/services/web/test/unit/src/Subscription/V1SusbcriptionManagerTests.js b/services/web/test/unit/src/Subscription/V1SusbcriptionManagerTests.js index f8b8e97122..c0622b3ed8 100644 --- a/services/web/test/unit/src/Subscription/V1SusbcriptionManagerTests.js +++ b/services/web/test/unit/src/Subscription/V1SusbcriptionManagerTests.js @@ -73,7 +73,7 @@ describe('V1SubscriptionManager', function() { }) }) - return describe('when all goes well', function() { + describe('when all goes well', function() { it('should call _v1Request', function(done) { return this.call((err, planCode) => { expect(this.V1SubscriptionManager._v1Request.callCount).to.equal(1) @@ -99,12 +99,12 @@ describe('V1SubscriptionManager', function() { }) }) - return describe('when the plan_name from v1 is null', function() { + describe('when the plan_name from v1 is null', function() { beforeEach(function() { return (this.responseBody.plan_name = null) }) - return it('should produce a null plan-code without error', function(done) { + it('should produce a null plan-code without error', function(done) { return this.call((err, planCode) => { expect(err).to.not.exist expect(planCode).to.equal(null) @@ -124,7 +124,7 @@ describe('V1SubscriptionManager', function() { return done() })) - return describe('when the user ID is less than the cutoff', () => + describe('when the user ID is less than the cutoff', () => it('should return a feature set with grandfathered properties for github and mendeley', function(done) { expect( this.V1SubscriptionManager.getGrandfatheredFeaturesForV1User(1) @@ -166,7 +166,7 @@ describe('V1SubscriptionManager', function() { }) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, planCode) => { expect(err).to.exist return done() @@ -197,7 +197,7 @@ describe('V1SubscriptionManager', function() { }) }) - return it('should not error', function(done) { + it('should not error', function(done) { return this.call(err => { expect(err).to.not.exist return done() @@ -221,7 +221,7 @@ describe('V1SubscriptionManager', function() { }) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call(err => { expect(err).to.exist return done() @@ -262,7 +262,7 @@ describe('V1SubscriptionManager', function() { }) }) - return it('should return the http response body', function(done) { + it('should return the http response body', function(done) { return this.call((err, body, v1Id) => { expect(body).to.equal('{}') return done() @@ -289,7 +289,7 @@ describe('V1SubscriptionManager', function() { }) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, body, v1Id) => { expect(err).to.exist return done() @@ -297,7 +297,7 @@ describe('V1SubscriptionManager', function() { }) }) - return describe('when the call returns an http not-found status code', function() { + describe('when the call returns an http not-found status code', function() { beforeEach(function() { this.V1SubscriptionManager.v1IdForUser = sinon .stub() @@ -316,7 +316,7 @@ describe('V1SubscriptionManager', function() { }) }) - return it('should produce an not-found error', function(done) { + it('should produce an not-found error', function(done) { return this.call((err, body, v1Id) => { expect(err).to.exist expect(err.name).to.equal('NotFoundError') @@ -326,7 +326,7 @@ describe('V1SubscriptionManager', function() { }) }) - return describe('v1IdForUser', function() { + describe('v1IdForUser', function() { beforeEach(function() { return (this.UserGetter.getUser = sinon.stub().yields(null, this.user)) }) @@ -339,7 +339,7 @@ describe('V1SubscriptionManager', function() { }) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call(err => { expect(err).to.exist return done() @@ -355,7 +355,7 @@ describe('V1SubscriptionManager', function() { }) }) - return it('should not error', function(done) { + it('should not error', function(done) { return this.call((err, user_id) => { expect(err).to.not.exist return done() @@ -363,7 +363,7 @@ describe('V1SubscriptionManager', function() { }) }) - return describe('when it works', function() { + describe('when it works', function() { beforeEach(function() { return (this.call = cb => { return this.V1SubscriptionManager.v1IdForUser(this.user_id, cb) @@ -377,7 +377,7 @@ describe('V1SubscriptionManager', function() { }) }) - return it('should return the v1 user id', function(done) { + it('should return the v1 user id', function(done) { return this.call((err, user_id) => { expect(user_id).to.eql(42) return done() diff --git a/services/web/test/unit/src/SudoMode/SudoModeControllerTests.js b/services/web/test/unit/src/SudoMode/SudoModeControllerTests.js index 6a3b694f24..95698ccbd1 100644 --- a/services/web/test/unit/src/SudoMode/SudoModeControllerTests.js +++ b/services/web/test/unit/src/SudoMode/SudoModeControllerTests.js @@ -116,13 +116,13 @@ describe('SudoModeController', function() { return expect(this.next.lastCall.args[0]).to.be.instanceof(Error) }) - return it('should not render page', function() { + it('should not render page', function() { this.SudoModeController.sudoModePrompt(this.req, this.res, this.next) return this.res.render.callCount.should.equal(0) }) }) - return describe('when external auth system is used', function() { + describe('when external auth system is used', function() { beforeEach(function() { return (this.req.externalAuthenticationSystemUsed = sinon .stub() @@ -140,14 +140,14 @@ describe('SudoModeController', function() { return this.SudoModeHandler.isSudoModeActive.callCount.should.equal(0) }) - return it('should not render page', function() { + it('should not render page', function() { this.SudoModeController.sudoModePrompt(this.req, this.res, this.next) return this.res.render.callCount.should.equal(0) }) }) }) - return describe('submitPassword', function() { + describe('submitPassword', function() { beforeEach(function() { this.AuthenticationController._getRedirectFromSession = sinon .stub() @@ -163,7 +163,7 @@ describe('SudoModeController', function() { return (this.next = sinon.stub()) }) - return describe('when all goes well', function() { + describe('when all goes well', function() { beforeEach(function() {}) it('should get the logged in user id', function() { @@ -250,7 +250,7 @@ describe('SudoModeController', function() { return this.SudoModeHandler.activateSudoMode.callCount.should.equal(0) }) - return it('should not send back a json response', function() { + it('should not send back a json response', function() { this.SudoModeController.submitPassword(this.req, this.res, this.next) return this.res.json.callCount.should.equal(0) }) @@ -288,7 +288,7 @@ describe('SudoModeController', function() { return this.SudoModeHandler.activateSudoMode.callCount.should.equal(0) }) - return it('should not send back a json response', function() { + it('should not send back a json response', function() { this.SudoModeController.submitPassword(this.req, this.res, this.next) return this.res.json.callCount.should.equal(0) }) @@ -324,7 +324,7 @@ describe('SudoModeController', function() { return this.SudoModeHandler.activateSudoMode.callCount.should.equal(0) }) - return it('should not send back a json response', function() { + it('should not send back a json response', function() { this.SudoModeController.submitPassword(this.req, this.res, this.next) return this.res.json.callCount.should.equal(0) }) @@ -367,7 +367,7 @@ describe('SudoModeController', function() { .should.equal(true) }) - return it('should not activate sudo mode', function() { + it('should not activate sudo mode', function() { this.SudoModeController.submitPassword(this.req, this.res, this.next) return this.SudoModeHandler.activateSudoMode.callCount.should.equal(0) }) @@ -403,13 +403,13 @@ describe('SudoModeController', function() { .should.equal(true) }) - return it('should not activate sudo mode', function() { + it('should not activate sudo mode', function() { this.SudoModeController.submitPassword(this.req, this.res, this.next) return this.SudoModeHandler.activateSudoMode.callCount.should.equal(0) }) }) - return describe('when sudo mode activation produces an error', function() { + describe('when sudo mode activation produces an error', function() { beforeEach(function() { this.SudoModeHandler.activateSudoMode = sinon .stub() @@ -439,7 +439,7 @@ describe('SudoModeController', function() { .should.equal(true) }) - return it('should have tried to activate sudo mode', function() { + it('should have tried to activate sudo mode', function() { this.SudoModeController.submitPassword(this.req, this.res, this.next) this.SudoModeHandler.activateSudoMode.callCount.should.equal(1) return this.SudoModeHandler.activateSudoMode diff --git a/services/web/test/unit/src/SudoMode/SudoModeHandlerTests.js b/services/web/test/unit/src/SudoMode/SudoModeHandlerTests.js index 5b500dc192..c90c2e3bdc 100644 --- a/services/web/test/unit/src/SudoMode/SudoModeHandlerTests.js +++ b/services/web/test/unit/src/SudoMode/SudoModeHandlerTests.js @@ -72,7 +72,7 @@ describe('SudoModeHandler', function() { }) }) - return it('should set a value in redis', function(done) { + it('should set a value in redis', function(done) { return this.call(err => { expect(this.rclient.set.callCount).to.equal(1) expect( @@ -103,7 +103,7 @@ describe('SudoModeHandler', function() { }) }) - return it('should not set value in redis', function(done) { + it('should not set value in redis', function(done) { return this.call(err => { expect(this.rclient.set.callCount).to.equal(0) return done() @@ -111,14 +111,14 @@ describe('SudoModeHandler', function() { }) }) - return describe('when rclient.set produces an error', function() { + describe('when rclient.set produces an error', function() { beforeEach(function() { return (this.rclient.set = sinon .stub() .callsArgWith(4, new Error('woops'))) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call(err => { expect(err).to.not.equal(null) expect(err).to.be.instanceof(Error) @@ -160,7 +160,7 @@ describe('SudoModeHandler', function() { .callsArgWith(1, new Error('woops'))) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call(err => { expect(err).to.not.equal(null) expect(err).to.be.instanceof(Error) @@ -169,7 +169,7 @@ describe('SudoModeHandler', function() { }) }) - return describe('when user id is not supplied', function() { + describe('when user id is not supplied', function() { beforeEach(function() { return (this.call = cb => { return this.SudoModeHandler.clearSudoMode(null, cb) @@ -184,7 +184,7 @@ describe('SudoModeHandler', function() { }) }) - return it('should not delete value in redis', function(done) { + it('should not delete value in redis', function(done) { return this.call(err => { expect(this.rclient.del.callCount).to.equal(0) return done() @@ -200,7 +200,7 @@ describe('SudoModeHandler', function() { .callsArgWith(2, null, this.user)) }) - return it('should call AuthenticationManager.authenticate', function(done) { + it('should call AuthenticationManager.authenticate', function(done) { return this.SudoModeHandler.authenticate( this.email, 'password', @@ -215,7 +215,7 @@ describe('SudoModeHandler', function() { }) }) - return describe('isSudoModeActive', function() { + describe('isSudoModeActive', function() { beforeEach(function() { return (this.call = cb => { return this.SudoModeHandler.isSudoModeActive(this.userId, cb) @@ -244,7 +244,7 @@ describe('SudoModeHandler', function() { }) }) - return it('should produce a true result', function(done) { + it('should produce a true result', function(done) { return this.call((err, isActive) => { expect(isActive).to.equal(true) return done() @@ -274,7 +274,7 @@ describe('SudoModeHandler', function() { }) }) - return it('should produce a false result', function(done) { + it('should produce a false result', function(done) { return this.call((err, isActive) => { expect(isActive).to.equal(false) return done() @@ -289,7 +289,7 @@ describe('SudoModeHandler', function() { .callsArgWith(1, new Error('woops'))) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, isActive) => { expect(err).to.not.equal(null) expect(err).to.be.instanceof(Error) @@ -299,7 +299,7 @@ describe('SudoModeHandler', function() { }) }) - return describe('when user id is not supplied', function() { + describe('when user id is not supplied', function() { beforeEach(function() { return (this.call = cb => { return this.SudoModeHandler.isSudoModeActive(null, cb) @@ -314,7 +314,7 @@ describe('SudoModeHandler', function() { }) }) - return it('should not get value in redis', function(done) { + it('should not get value in redis', function(done) { return this.call(err => { expect(this.rclient.get.callCount).to.equal(0) return done() diff --git a/services/web/test/unit/src/SudoMode/SudoModeMiddlewareTests.js b/services/web/test/unit/src/SudoMode/SudoModeMiddlewareTests.js index 1fecdcbd28..e6dba72592 100644 --- a/services/web/test/unit/src/SudoMode/SudoModeMiddlewareTests.js +++ b/services/web/test/unit/src/SudoMode/SudoModeMiddlewareTests.js @@ -39,7 +39,7 @@ describe('SudoModeMiddleware', function() { })) }) - return describe('protectPage', function() { + describe('protectPage', function() { beforeEach(function() { this.externalAuth = false return (this.call = cb => { @@ -84,7 +84,7 @@ describe('SudoModeMiddleware', function() { }) }) - return it('should call next', function(done) { + it('should call next', function(done) { return this.call(() => { this.next.callCount.should.equal(1) expect(this.next.lastCall.args[0]).to.equal(undefined) @@ -135,7 +135,7 @@ describe('SudoModeMiddleware', function() { }) }) - return it('should redirect to the password-prompt page', function(done) { + it('should redirect to the password-prompt page', function(done) { return this.call(() => { this.res.redirect.callCount.should.equal(1) this.res.redirect.calledWith('/confirm-password').should.equal(true) @@ -173,7 +173,7 @@ describe('SudoModeMiddleware', function() { }) }) - return it('should call next with an error', function(done) { + it('should call next with an error', function(done) { return this.call(() => { this.next.callCount.should.equal(1) expect(this.next.lastCall.args[0]).to.be.instanceof(Error) @@ -182,7 +182,7 @@ describe('SudoModeMiddleware', function() { }) }) - return describe('when external auth is being used', function() { + describe('when external auth is being used', function() { beforeEach(function() { this.externalAuth = true return (this.call = cb => { @@ -215,7 +215,7 @@ describe('SudoModeMiddleware', function() { }) }) - return it('should not check if sudo-mode is active', function(done) { + it('should not check if sudo-mode is active', function(done) { return this.call(() => { this.SudoModeHandler.isSudoModeActive.callCount.should.equal(0) return done() diff --git a/services/web/test/unit/src/SystemMessages/SystemMessageManagerTests.js b/services/web/test/unit/src/SystemMessages/SystemMessageManagerTests.js index 29a7f90650..3cc79935f9 100644 --- a/services/web/test/unit/src/SystemMessages/SystemMessageManagerTests.js +++ b/services/web/test/unit/src/SystemMessages/SystemMessageManagerTests.js @@ -51,14 +51,14 @@ describe('SystemMessageManager', function() { return this.callback.calledWith(null, this.messages).should.equal(true) }) - return it('should cache the messages', function() { + it('should cache the messages', function() { return this.SystemMessageManager._cachedMessages.should.equal( this.messages ) }) }) - return describe('when the messages are cached', function() { + describe('when the messages are cached', function() { beforeEach(function() { this.SystemMessageManager._cachedMessages = this.messages return this.SystemMessageManager.getMessages(this.callback) @@ -68,13 +68,13 @@ describe('SystemMessageManager', function() { return this.SystemMessage.find.called.should.equal(false) }) - return it('should return the messages', function() { + it('should return the messages', function() { return this.callback.calledWith(null, this.messages).should.equal(true) }) }) }) - return describe('clearMessages', function() { + describe('clearMessages', function() { beforeEach(function() { this.SystemMessage.remove = sinon.stub().callsArg(1) return this.SystemMessageManager.clearMessages(this.callback) @@ -84,7 +84,7 @@ describe('SystemMessageManager', function() { return this.SystemMessage.remove.calledWith({}).should.equal(true) }) - return it('should return the callback', function() { + it('should return the callback', function() { return this.callback.called.should.equal(true) }) }) diff --git a/services/web/test/unit/src/Tags/TagsControllerTests.js b/services/web/test/unit/src/Tags/TagsControllerTests.js index d854cf8436..39f107f54e 100644 --- a/services/web/test/unit/src/Tags/TagsControllerTests.js +++ b/services/web/test/unit/src/Tags/TagsControllerTests.js @@ -93,7 +93,7 @@ describe('TagsController', function() { .should.equal(true) }) - return it('should return the tag', function() { + it('should return the tag', function() { return this.res.json.calledWith(this.tag).should.equal(true) }) }) @@ -111,7 +111,7 @@ describe('TagsController', function() { .should.equal(true) }) - return it('should return 204 status code', function() { + it('should return 204 status code', function() { this.res.status.calledWith(204).should.equal(true) return this.res.end.called.should.equal(true) }) @@ -135,13 +135,13 @@ describe('TagsController', function() { .should.equal(true) }) - return it('should return 204 status code', function() { + it('should return 204 status code', function() { this.res.status.calledWith(204).should.equal(true) return this.res.end.called.should.equal(true) }) }) - return describe('without a name', function() { + describe('without a name', function() { beforeEach(function() { return this.controller.renameTag(this.req, this.res) }) @@ -150,7 +150,7 @@ describe('TagsController', function() { return this.handler.renameTag.called.should.equal(false) }) - return it('should return 400 (bad request) status code', function() { + it('should return 400 (bad request) status code', function() { this.res.status.calledWith(400).should.equal(true) return this.res.end.called.should.equal(true) }) @@ -171,13 +171,13 @@ describe('TagsController', function() { .should.equal(true) }) - return it('should return 204 status code', function() { + it('should return 204 status code', function() { this.res.status.calledWith(204).should.equal(true) return this.res.end.called.should.equal(true) }) }) - return describe('removeProjectFromTag', function() { + describe('removeProjectFromTag', function() { beforeEach(function() { this.req.params.tag_id = this.tag_id = 'tag-id-123' this.req.params.project_id = this.project_id = 'project-id-123' @@ -191,7 +191,7 @@ describe('TagsController', function() { .should.equal(true) }) - return it('should return 204 status code', function() { + it('should return 204 status code', function() { this.res.status.calledWith(204).should.equal(true) return this.res.end.called.should.equal(true) }) diff --git a/services/web/test/unit/src/Tags/TagsHandlerTests.js b/services/web/test/unit/src/Tags/TagsHandlerTests.js index bf1d1005da..86bf2478c3 100644 --- a/services/web/test/unit/src/Tags/TagsHandlerTests.js +++ b/services/web/test/unit/src/Tags/TagsHandlerTests.js @@ -118,7 +118,7 @@ describe('TagsHandler', function() { }) }) - return it('should return an err and empty array on no body and no response', function(done) { + it('should return an err and empty array on no body and no response', function(done) { this.request.get.callsArgWith( 1, { something: 'wrong' }, @@ -156,7 +156,7 @@ describe('TagsHandler', function() { }) }) - return it('should return empty arrays if there are no tags', function() { + it('should return empty arrays if there are no tags', function() { this.request.get.callsArgWith(1, null, { statusCode: 200 }, null) return this.handler.getAllTags( user_id, @@ -192,7 +192,7 @@ describe('TagsHandler', function() { .should.equal(true) }) - return it('should call the callback with no error', function() { + it('should call the callback with no error', function() { return this.callback.calledWith(null).should.equal(true) }) }) @@ -215,12 +215,12 @@ describe('TagsHandler', function() { .should.equal(true) }) - return it('should call the callback with no error', function() { + it('should call the callback with no error', function() { return this.callback.calledWith(null).should.equal(true) }) }) - return describe('with error', function() { + describe('with error', function() { beforeEach(function() { this.request.del = sinon .stub() @@ -228,7 +228,7 @@ describe('TagsHandler', function() { return this.handler.deleteTag(user_id, tag_id, this.callback) }) - return it('should call the callback with an Error', function() { + it('should call the callback with an Error', function() { return this.callback.calledWith(new Error()).should.equal(true) }) }) @@ -260,12 +260,12 @@ describe('TagsHandler', function() { .should.equal(true) }) - return it('should call the callback with no error', function() { + it('should call the callback with no error', function() { return this.callback.calledWith(null).should.equal(true) }) }) - return describe('with error', function() { + describe('with error', function() { beforeEach(function() { this.request.post = sinon .stub() @@ -273,7 +273,7 @@ describe('TagsHandler', function() { return this.handler.renameTag(user_id, tag_id, 'name', this.callback) }) - return it('should call the callback with an Error', function() { + it('should call the callback with an Error', function() { return this.callback.calledWith(new Error()).should.equal(true) }) }) @@ -302,12 +302,12 @@ describe('TagsHandler', function() { .should.equal(true) }) - return it('should call the callback with no error', function() { + it('should call the callback with no error', function() { return this.callback.calledWith(null).should.equal(true) }) }) - return describe('with error', function() { + describe('with error', function() { beforeEach(function() { this.request.del = sinon .stub() @@ -320,7 +320,7 @@ describe('TagsHandler', function() { ) }) - return it('should call the callback with an Error', function() { + it('should call the callback with an Error', function() { return this.callback.calledWith(new Error()).should.equal(true) }) }) @@ -349,12 +349,12 @@ describe('TagsHandler', function() { .should.equal(true) }) - return it('should call the callback with no error', function() { + it('should call the callback with no error', function() { return this.callback.calledWith(null).should.equal(true) }) }) - return describe('with error', function() { + describe('with error', function() { beforeEach(function() { this.request.post = sinon .stub() @@ -367,7 +367,7 @@ describe('TagsHandler', function() { ) }) - return it('should call the callback with an Error', function() { + it('should call the callback with an Error', function() { return this.callback.calledWith(new Error()).should.equal(true) }) }) @@ -399,12 +399,12 @@ describe('TagsHandler', function() { .should.equal(true) }) - return it('should call the callback with no error', function() { + it('should call the callback with no error', function() { return this.callback.calledWith(null).should.equal(true) }) }) - return describe('with error', function() { + describe('with error', function() { beforeEach(function() { this.request.post = sinon .stub() @@ -417,13 +417,13 @@ describe('TagsHandler', function() { ) }) - return it('should call the callback with an Error', function() { + it('should call the callback with an Error', function() { return this.callback.calledWith(new Error()).should.equal(true) }) }) }) - return describe('updateTagUserIds', function() { + describe('updateTagUserIds', function() { describe('successfully', function() { beforeEach(function() { this.request.put = sinon @@ -448,12 +448,12 @@ describe('TagsHandler', function() { .should.equal(true) }) - return it('should call the callback with no error', function() { + it('should call the callback with no error', function() { return this.callback.calledWith(null).should.equal(true) }) }) - return describe('with error', function() { + describe('with error', function() { beforeEach(function() { this.request.put = sinon .stub() @@ -465,7 +465,7 @@ describe('TagsHandler', function() { ) }) - return it('should call the callback with an Error', function() { + it('should call the callback with an Error', function() { return this.callback.calledWith(new Error()).should.equal(true) }) }) diff --git a/services/web/test/unit/src/Templates/TemplatesControllerTests.js b/services/web/test/unit/src/Templates/TemplatesControllerTests.js index e5cd86d548..e27c9d5c68 100644 --- a/services/web/test/unit/src/Templates/TemplatesControllerTests.js +++ b/services/web/test/unit/src/Templates/TemplatesControllerTests.js @@ -57,7 +57,7 @@ describe('TemplatesController', function() { return (this.res = { redirect: sinon.stub() }) }) - return describe('createProjectFromV1Template', function() { + describe('createProjectFromV1Template', function() { describe('on success', function() { beforeEach(function() { this.project = { _id: 'project-id' } @@ -90,12 +90,12 @@ describe('TemplatesController', function() { ) }) - return it('should delete session', function() { + it('should delete session', function() { return expect(this.req.session.templateData).to.be.undefined }) }) - return describe('on error', function() { + describe('on error', function() { beforeEach(function() { this.TemplatesManager.createProjectFromV1Template.yields('error') return this.TemplatesController.createProjectFromV1Template( @@ -109,7 +109,7 @@ describe('TemplatesController', function() { return this.next.should.have.been.calledWith('error') }) - return it('should not redirect', function() { + it('should not redirect', function() { return this.res.redirect.called.should.equal(false) }) }) diff --git a/services/web/test/unit/src/Templates/TemplatesManagerTests.js b/services/web/test/unit/src/Templates/TemplatesManagerTests.js index 45675c8c09..e557e9cc53 100644 --- a/services/web/test/unit/src/Templates/TemplatesManagerTests.js +++ b/services/web/test/unit/src/Templates/TemplatesManagerTests.js @@ -107,7 +107,7 @@ describe('TemplatesManager', function() { '%2Ftemplates%2F52fb86a81ae1e566597a25f6%2Fv%2F4%2Fzip&templateName=Moderncv%20Banking&compiler=pdflatex') }) - return describe('createProjectFromV1Template', function() { + describe('createProjectFromV1Template', function() { describe('when all options passed', function() { beforeEach(function() { return this.TemplatesManager.createProjectFromV1Template( @@ -180,12 +180,12 @@ describe('TemplatesManager', function() { ) }) - return it('should ensure that the dump folder exists', function() { + it('should ensure that the dump folder exists', function() { return sinon.assert.called(this.FileWriter.ensureDumpFolderExists) }) }) - return describe('when some options not set', function() { + describe('when some options not set', function() { beforeEach(function() { return this.TemplatesManager.createProjectFromV1Template( null, @@ -200,7 +200,7 @@ describe('TemplatesManager', function() { ) }) - return it('should not set missing project options', function() { + it('should not set missing project options', function() { this.ProjectOptionsHandler.setCompiler.called.should.equal(false) this.ProjectRootDocManager.setRootDocFromName.called.should.equal(false) this.ProjectOptionsHandler.setBrandVariationId.called.should.equal( diff --git a/services/web/test/unit/src/ThirdPartyDataStore/TpdsControllerTests.js b/services/web/test/unit/src/ThirdPartyDataStore/TpdsControllerTests.js index 815328d8ee..28b7f2e615 100644 --- a/services/web/test/unit/src/ThirdPartyDataStore/TpdsControllerTests.js +++ b/services/web/test/unit/src/ThirdPartyDataStore/TpdsControllerTests.js @@ -102,7 +102,7 @@ describe('TpdsController', function() { return result.projectName.should.equal(path) }) - it('should take the project name off the start and return it with no slashes in', function() { + it('should take the project name off the start and it with no slashes in', function() { const path = '/project/file.tex' const req = { params: { 0: path, user_id: this.user_id } } const result = this.TpdsController.parseParams(req) @@ -111,7 +111,7 @@ describe('TpdsController', function() { return result.projectName.should.equal('project') }) - return it('should take the project name of and return a slash for the file path', function() { + it('should take the project name of and return a slash for the file path', function() { const path = '/project_name' const req = { params: { 0: path, user_id: this.user_id } } const result = this.TpdsController.parseParams(req) @@ -152,12 +152,12 @@ describe('TpdsController', function() { .should.equal(true) }) - return it('should return a success', function() { + it('should return a success', function() { return this.res.sendStatus.calledWith(200).should.equal(true) }) }) - return describe('deleteProjectContents', function() { + describe('deleteProjectContents', function() { beforeEach(function() { this.UpdateMerger.deleteUpdate = sinon.stub().callsArg(4) this.req = { @@ -183,7 +183,7 @@ describe('TpdsController', function() { .should.equal(true) }) - return it('should return a success', function() { + it('should return a success', function() { return this.res.sendStatus.calledWith(200).should.equal(true) }) }) diff --git a/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateHandlerTests.js b/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateHandlerTests.js index 3040837ab9..652dcf5caa 100644 --- a/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateHandlerTests.js +++ b/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateHandlerTests.js @@ -181,7 +181,7 @@ describe('TpdsUpdateHandler', function() { ) }) - return it('should return error and not proceed with update if project is on cooldown', function(done) { + it('should return error and not proceed with update if project is on cooldown', function(done) { this.CooldownManager.isProjectOnCooldown = sinon .stub() .callsArgWith(1, null, true) @@ -216,7 +216,7 @@ describe('TpdsUpdateHandler', function() { }) }) - return describe('getting a delete :', function() { + describe('getting a delete :', function() { it('should call deleteEntity in the collaberation manager', function(done) { const path = '/delete/this' const update = {} @@ -239,7 +239,7 @@ describe('TpdsUpdateHandler', function() { ) }) - return it('should mark the project as deleted by external source if path is a single slash', function(done) { + it('should mark the project as deleted by external source if path is a single slash', function(done) { const path = '/' return this.handler.deleteUpdate( this.user_id, diff --git a/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js b/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js index 36ec58814c..fa5e634b5a 100644 --- a/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js +++ b/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js @@ -82,7 +82,7 @@ describe('TpdsUpdateSender', function() { }) }) - return it('should post the message to the tpdsworker', function(done) { + it('should post the message to the tpdsworker', function(done) { this.settings.apis.tpdsworker = { url: 'www.tpdsworker.env' } const group = 'myproject' const method = 'somemethod' @@ -101,7 +101,7 @@ describe('TpdsUpdateSender', function() { }) }) - return describe('sending updates', function() { + describe('sending updates', function() { it('queues a post the file with user and file id', function(done) { const file_id = '4545345' const path = '/some/path/here.jpg' @@ -219,7 +219,7 @@ describe('TpdsUpdateSender', function() { }) }) - return it('pollDropboxForUser', function(done) { + it('pollDropboxForUser', function(done) { this.updateSender._enqueue = sinon.stub().callsArg(3) return this.updateSender.pollDropboxForUser(user_id, error => { this.updateSender._enqueue diff --git a/services/web/test/unit/src/ThirdPartyDataStore/UpdateMergerTests.js b/services/web/test/unit/src/ThirdPartyDataStore/UpdateMergerTests.js index 1265f0fb1d..407916a1cc 100644 --- a/services/web/test/unit/src/ThirdPartyDataStore/UpdateMergerTests.js +++ b/services/web/test/unit/src/ThirdPartyDataStore/UpdateMergerTests.js @@ -91,7 +91,7 @@ describe('UpdateMerger :', function() { .should.equal(true) }) - return it('removes the temp file from disk', function() { + it('removes the temp file from disk', function() { return this.fs.unlink.calledWith(this.fsPath).should.equal(true) }) }) @@ -126,7 +126,7 @@ describe('UpdateMerger :', function() { .should.equal(true) }) - return it('removes the temp file from disk', function() { + it('removes the temp file from disk', function() { return this.fs.unlink.calledWith(this.fsPath).should.equal(true) }) }) @@ -161,12 +161,12 @@ describe('UpdateMerger :', function() { .should.equal(true) }) - return it('removes the temp file from disk', function() { + it('removes the temp file from disk', function() { return this.fs.unlink.calledWith(this.fsPath).should.equal(true) }) }) - return describe('file updates for an existing file', function() { + describe('file updates for an existing file', function() { beforeEach(function() { this.FileTypeManager.getType = sinon.stub() this.updateMerger.p.processFile = sinon.stub().yields() @@ -196,7 +196,7 @@ describe('UpdateMerger :', function() { .should.equal(true) }) - return it('removes the temp file from disk', function() { + it('removes the temp file from disk', function() { return this.fs.unlink.calledWith(this.fsPath).should.equal(true) }) }) @@ -214,14 +214,14 @@ describe('UpdateMerger :', function() { ) }) - return it('should delete the entity in the editor controller', function() { + it('should delete the entity in the editor controller', function() { return this.EditorController.deleteEntityWithPath .calledWith(this.project_id, this.docPath, this.source, this.user_id) .should.equal(true) }) }) - return describe('private methods', function() { + describe('private methods', function() { describe('processDoc', function() { beforeEach(function() { this.docLines = @@ -247,7 +247,7 @@ describe('UpdateMerger :', function() { .should.equal(true) }) - return it('should upsert the doc in the editor controller', function() { + it('should upsert the doc in the editor controller', function() { return this.EditorController.upsertDocWithPath .calledWith( this.project_id, @@ -260,7 +260,7 @@ describe('UpdateMerger :', function() { }) }) - return describe('processFile', function() { + describe('processFile', function() { beforeEach(function() { this.EditorController.upsertFileWithPath = sinon.stub().yields() return this.updateMerger.p.processFile( @@ -273,7 +273,7 @@ describe('UpdateMerger :', function() { ) }) - return it('should upsert the file in the editor controller', function() { + it('should upsert the file in the editor controller', function() { return this.EditorController.upsertFileWithPath .calledWith( this.project_id, diff --git a/services/web/test/unit/src/TokenAccess/TokenAccessControllerTests.js b/services/web/test/unit/src/TokenAccess/TokenAccessControllerTests.js index 9d7f12eff8..d86a8e4901 100644 --- a/services/web/test/unit/src/TokenAccess/TokenAccessControllerTests.js +++ b/services/web/test/unit/src/TokenAccess/TokenAccessControllerTests.js @@ -123,7 +123,7 @@ describe('TokenAccessController', function() { return done() }) - return it('should pass control to loadEditor', function(done) { + it('should pass control to loadEditor', function(done) { expect(this.req.params.Project_id).to.equal(this.projectId.toString()) expect(this.ProjectController.loadEditor.callCount).to.equal(1) expect( @@ -177,7 +177,7 @@ describe('TokenAccessController', function() { return done() }) - return it('should pass control to loadEditor', function(done) { + it('should pass control to loadEditor', function(done) { expect(this.req.params.Project_id).to.equal(this.projectId.toString()) expect(this.ProjectController.loadEditor.callCount).to.equal(1) expect( @@ -241,7 +241,7 @@ describe('TokenAccessController', function() { return done() }) - return it('should pass control to loadEditor', function(done) { + it('should pass control to loadEditor', function(done) { expect(this.req.params.Project_id).to.equal(this.projectId.toString()) expect(this.ProjectController.loadEditor.callCount).to.equal(1) expect( @@ -255,7 +255,7 @@ describe('TokenAccessController', function() { }) }) - return describe('when anonymous read-write access is not enabled', function() { + describe('when anonymous read-write access is not enabled', function() { beforeEach(function() { this.TokenAccessHandler.ANONYMOUS_READ_AND_WRITE_ENABLED = false this.req = new MockRequest() @@ -317,7 +317,7 @@ describe('TokenAccessController', function() { return done() }) - return it('should redirect to restricted page', function(done) { + it('should redirect to restricted page', function(done) { expect(this.res.redirect.callCount).to.equal(1) expect(this.res.redirect.calledWith('/restricted')).to.equal(true) return done() @@ -376,7 +376,7 @@ describe('TokenAccessController', function() { return done() }) - return it('should call next with an error', function(done) { + it('should call next with an error', function(done) { expect(this.next.callCount).to.equal(1) expect(this.next.lastCall.args[0]).to.be.instanceof(Error) return done() @@ -386,7 +386,7 @@ describe('TokenAccessController', function() { describe('when findProject does not find a project', function() { beforeEach(function() {}) - return describe('when user is present', function() { + describe('when user is present', function() { beforeEach(function() { return (this.AuthenticationController.getLoggedInUserId = sinon .stub() @@ -420,7 +420,7 @@ describe('TokenAccessController', function() { ) }) - return it('should redirect to v1', function(done) { + it('should redirect to v1', function(done) { expect(this.res.redirect.callCount).to.equal(1) expect( this.res.redirect.calledWith( @@ -456,7 +456,7 @@ describe('TokenAccessController', function() { ) }) - return it('should render v2-import page with name', function(done) { + it('should render v2-import page with name', function(done) { expect( this.res.render.calledWith('project/v2-import', { projectId: '123abc', @@ -489,7 +489,7 @@ describe('TokenAccessController', function() { ) }) - return it('should render v2-import page', function(done) { + it('should render v2-import page', function(done) { expect( this.res.render.calledWith('project/v2-import', { projectId: '123abc', @@ -522,7 +522,7 @@ describe('TokenAccessController', function() { ) }) - return it('should render v2-import page', function(done) { + it('should render v2-import page', function(done) { expect( this.res.render.calledWith('project/v2-import', { projectId: '123abc', @@ -555,7 +555,7 @@ describe('TokenAccessController', function() { ) }) - return it('should render v2-import page', function(done) { + it('should render v2-import page', function(done) { expect( this.res.render.calledWith('project/v2-import', { projectId: '123abc', @@ -588,7 +588,7 @@ describe('TokenAccessController', function() { ) }) - return it('should render v2-import page', function(done) { + it('should render v2-import page', function(done) { expect( this.res.render.calledWith('project/v2-import', { projectId: '123abc', @@ -602,7 +602,7 @@ describe('TokenAccessController', function() { }) }) - return describe('with anonymous user', function() { + describe('with anonymous user', function() { beforeEach(function() { this.AuthenticationController.getLoggedInUserId = sinon .stub() @@ -614,7 +614,7 @@ describe('TokenAccessController', function() { ) }) - return it('should render anonymous import status page', function(done) { + it('should render anonymous import status page', function(done) { expect(this.res.render.callCount).to.equal(1) expect( this.res.render.calledWith('project/v2-import', { @@ -639,13 +639,13 @@ describe('TokenAccessController', function() { ) }) - return it('should call next with a not-found error', function(done) { + it('should call next with a not-found error', function(done) { expect(this.next.callCount).to.equal(1) return done() }) }) - return describe('when project does not exist on v1', function() { + describe('when project does not exist on v1', function() { beforeEach(function() { this.TokenAccessHandler.getV1DocInfo = sinon.stub().yields(null, { exists: false, @@ -658,7 +658,7 @@ describe('TokenAccessController', function() { ) }) - return it('should call next with a not-found error', function(done) { + it('should call next with a not-found error', function(done) { expect(this.next.callCount).to.equal(1) expect(this.next.calledWith(new Errors.NotFoundError())).to.equal( true @@ -735,7 +735,7 @@ describe('TokenAccessController', function() { return done() }) - return it('should redirect to the canonical project url', function(done) { + it('should redirect to the canonical project url', function(done) { expect(this.res.redirect.callCount).to.equal(1) expect( this.res.redirect.calledWith(302, `/project/${this.project._id}`) @@ -744,7 +744,7 @@ describe('TokenAccessController', function() { }) }) - return describe('when higher access is not available', function() { + describe('when higher access is not available', function() { beforeEach(function() { this.req = new MockRequest() this.res = new MockResponse() @@ -805,7 +805,7 @@ describe('TokenAccessController', function() { return done() }) - return it('should call next with a not-found error', function(done) { + it('should call next with a not-found error', function(done) { expect(this.next.callCount).to.equal(1) expect(this.next.lastCall.args[0]).to.be.instanceof(Error) return done() @@ -814,7 +814,7 @@ describe('TokenAccessController', function() { }) }) - return describe('when adding user to project produces an error', function() { + describe('when adding user to project produces an error', function() { beforeEach(function() { this.req = new MockRequest() this.res = new MockResponse() @@ -871,7 +871,7 @@ describe('TokenAccessController', function() { return done() }) - return it('should call next with an error', function(done) { + it('should call next with an error', function(done) { expect(this.next.callCount).to.equal(1) expect(this.next.lastCall.args[0]).to.be.instanceof(Error) return done() @@ -879,7 +879,7 @@ describe('TokenAccessController', function() { }) }) - return describe('readOnlyToken', function() { + describe('readOnlyToken', function() { beforeEach(function() { return (this.TokenAccessHandler.checkV1Access = sinon .stub() @@ -908,7 +908,7 @@ describe('TokenAccessController', function() { ) }) - return it('should redirect to doc-url', function() { + it('should redirect to doc-url', function() { return expect(this.res.redirect.calledWith('doc-url')).to.equal(true) }) }) @@ -965,7 +965,7 @@ describe('TokenAccessController', function() { return done() }) - return it('should pass control to loadEditor', function(done) { + it('should pass control to loadEditor', function(done) { expect(this.req.params.Project_id).to.equal(this.projectId.toString()) expect(this.ProjectController.loadEditor.callCount).to.equal(1) expect( @@ -1019,7 +1019,7 @@ describe('TokenAccessController', function() { return done() }) - return it('should pass control to loadEditor', function(done) { + it('should pass control to loadEditor', function(done) { expect(this.req.params.Project_id).to.equal(this.projectId.toString()) expect(this.ProjectController.loadEditor.callCount).to.equal(1) expect( @@ -1033,7 +1033,7 @@ describe('TokenAccessController', function() { }) }) - return describe('when findProject produces an error', function() { + describe('when findProject produces an error', function() { beforeEach(function() { this.req = new MockRequest() this.res = new MockResponse() @@ -1084,7 +1084,7 @@ describe('TokenAccessController', function() { return done() }) - return it('should call next with an error', function(done) { + it('should call next with an error', function(done) { expect(this.next.callCount).to.equal(1) expect(this.next.lastCall.args[0]).to.be.instanceof(Error) return done() @@ -1113,7 +1113,7 @@ describe('TokenAccessController', function() { ) }) - return it('should redirect to v1', function(done) { + it('should redirect to v1', function(done) { expect(this.res.redirect.callCount).to.equal(1) expect( this.res.redirect.calledWith( @@ -1155,7 +1155,7 @@ describe('TokenAccessController', function() { ) }) - return it('should render v2-import page with name', function(done) { + it('should render v2-import page with name', function(done) { expect( this.res.render.calledWith('project/v2-import', { projectId: 'abcd', @@ -1186,7 +1186,7 @@ describe('TokenAccessController', function() { ) }) - return it('should render v2-import page', function(done) { + it('should render v2-import page', function(done) { expect( this.res.render.calledWith('project/v2-import', { projectId: 'abcd', @@ -1217,7 +1217,7 @@ describe('TokenAccessController', function() { ) }) - return it('should render v2-import page', function(done) { + it('should render v2-import page', function(done) { expect( this.res.render.calledWith('project/v2-import', { projectId: 'abcd', @@ -1248,7 +1248,7 @@ describe('TokenAccessController', function() { ) }) - return it('should render v2-import page', function(done) { + it('should render v2-import page', function(done) { expect( this.res.render.calledWith('project/v2-import', { projectId: 'abcd', @@ -1262,7 +1262,7 @@ describe('TokenAccessController', function() { }) }) - return describe('with brand info', function() { + describe('with brand info', function() { beforeEach(function() { this.TokenAccessHandler.getV1DocInfo = sinon.stub().yields(null, { exists: true, @@ -1279,7 +1279,7 @@ describe('TokenAccessController', function() { ) }) - return it('should render v2-import page', function(done) { + it('should render v2-import page', function(done) { expect( this.res.render.calledWith('project/v2-import', { projectId: 'abcd', @@ -1316,7 +1316,7 @@ describe('TokenAccessController', function() { ) }) - return it('should call next with a not-found error', function(done) { + it('should call next with a not-found error', function(done) { expect(this.next.callCount).to.equal(1) return done() }) @@ -1389,7 +1389,7 @@ describe('TokenAccessController', function() { return done() }) - return it('should redirect to the canonical project url', function(done) { + it('should redirect to the canonical project url', function(done) { expect(this.res.redirect.callCount).to.equal(1) expect( this.res.redirect.calledWith(302, `/project/${this.project._id}`) @@ -1398,7 +1398,7 @@ describe('TokenAccessController', function() { }) }) - return describe('when higher access is not available', function() { + describe('when higher access is not available', function() { beforeEach(function() { this.req = new MockRequest() this.res = new MockResponse() @@ -1459,7 +1459,7 @@ describe('TokenAccessController', function() { return done() }) - return it('should call next with a not-found error', function(done) { + it('should call next with a not-found error', function(done) { expect(this.next.callCount).to.equal(1) expect(this.next.lastCall.args[0]).to.be.instanceof(Error) return done() @@ -1524,14 +1524,14 @@ describe('TokenAccessController', function() { return done() }) - return it('should call next with an error', function(done) { + it('should call next with an error', function(done) { expect(this.next.callCount).to.equal(1) expect(this.next.lastCall.args[0]).to.be.instanceof(Error) return done() }) }) - return describe('anonymous', function() { + describe('anonymous', function() { beforeEach(function() { this.AuthenticationController.getLoggedInUserId = sinon .stub() @@ -1592,7 +1592,7 @@ describe('TokenAccessController', function() { return done() }) - return it('should pass control to loadEditor', function(done) { + it('should pass control to loadEditor', function(done) { expect(this.req.params.Project_id).to.equal(this.projectId.toString()) expect(this.req._anonymousAccessToken).to.equal(this.readOnlyToken) expect(this.ProjectController.loadEditor.callCount).to.equal(1) @@ -1665,14 +1665,14 @@ describe('TokenAccessController', function() { return done() }) - return it('should call next with an error', function(done) { + it('should call next with an error', function(done) { expect(this.next.callCount).to.equal(1) expect(this.next.lastCall.args[0]).to.be.instanceof(Error) return done() }) }) - return describe('when findProject does not find a project', function() { + describe('when findProject does not find a project', function() { beforeEach(function() { this.req = new MockRequest() this.res = new MockResponse() @@ -1716,7 +1716,7 @@ describe('TokenAccessController', function() { return done() }) - return it('should not add the user to the project with read-only access', function(done) { + it('should not add the user to the project with read-only access', function(done) { expect( this.TokenAccessHandler.addReadOnlyUserToProject.callCount ).to.equal(0) @@ -1737,7 +1737,7 @@ describe('TokenAccessController', function() { ) }) - return it('should call next with not found error', function(done) { + it('should call next with not found error', function(done) { expect(this.next.callCount).to.equal(1) expect(this.next.calledWith(new Errors.NotFoundError())).to.equal( true @@ -1759,7 +1759,7 @@ describe('TokenAccessController', function() { ) }) - return it('should redirect to v1', function(done) { + it('should redirect to v1', function(done) { expect(this.res.redirect.callCount).to.equal(1) expect( this.res.redirect.calledWith( @@ -1784,7 +1784,7 @@ describe('TokenAccessController', function() { ) }) - return it('should call next with not found error', function(done) { + it('should call next with not found error', function(done) { expect(this.next.callCount).to.equal(1) expect(this.next.calledWith(new Errors.NotFoundError())).to.equal( true @@ -1793,7 +1793,7 @@ describe('TokenAccessController', function() { }) }) - return describe('anonymous user', function() { + describe('anonymous user', function() { beforeEach(function() { return (this.AuthenticationController.getLoggedInUserId = sinon .stub() @@ -1813,7 +1813,7 @@ describe('TokenAccessController', function() { ) }) - return it('should redirect to v1', function(done) { + it('should redirect to v1', function(done) { expect(this.res.redirect.callCount).to.equal(1) expect( this.res.redirect.calledWith( @@ -1825,13 +1825,13 @@ describe('TokenAccessController', function() { }) }) - return describe('force-import-to-v2 flag is on', function() { + describe('force-import-to-v2 flag is on', function() { beforeEach(function() { this.res.render = sinon.stub() return this.Features.hasFeature.returns(true) }) - return describe('when project was not exported to v2', function() { + describe('when project was not exported to v2', function() { beforeEach(function() { this.TokenAccessHandler.getV1DocInfo = sinon .stub() @@ -1846,7 +1846,7 @@ describe('TokenAccessController', function() { ) }) - return it('should render anonymous import status page', function(done) { + it('should render anonymous import status page', function(done) { expect(this.res.render.callCount).to.equal(1) expect( this.res.render.calledWith('project/v2-import', { diff --git a/services/web/test/unit/src/TokenAccess/TokenAccessHandlerTests.js b/services/web/test/unit/src/TokenAccess/TokenAccessHandlerTests.js index 8c40f55902..4be9b460ee 100644 --- a/services/web/test/unit/src/TokenAccess/TokenAccessHandlerTests.js +++ b/services/web/test/unit/src/TokenAccess/TokenAccessHandlerTests.js @@ -97,7 +97,7 @@ describe('TokenAccessHandler', function() { .callsArgWith(2, new Error('woops'))) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.TokenAccessHandler.findProjectWithReadOnlyToken( this.token, (err, project) => { @@ -129,7 +129,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should return projectExists flag as true', function(done) { + it('should return projectExists flag as true', function(done) { return this.TokenAccessHandler.findProjectWithReadOnlyToken( this.token, function(err, project, projectExists) { @@ -140,7 +140,7 @@ describe('TokenAccessHandler', function() { }) }) - return describe('when project does not exist', function() { + describe('when project does not exist', function() { beforeEach(function() { return (this.Project.findOne = sinon.stub().callsArgWith(2, null, null)) }) @@ -156,7 +156,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should return projectExists flag as false', function(done) { + it('should return projectExists flag as false', function(done) { return this.TokenAccessHandler.findProjectWithReadOnlyToken( this.token, function(err, project, projectExists) { @@ -226,7 +226,7 @@ describe('TokenAccessHandler', function() { .callsArgWith(2, new Error('woops'))) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.TokenAccessHandler.findProjectWithReadAndWriteToken( this.token, (err, project) => { @@ -258,7 +258,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should return projectExists flag as true', function(done) { + it('should return projectExists flag as true', function(done) { return this.TokenAccessHandler.findProjectWithReadAndWriteToken( this.token, function(err, project, projectExists) { @@ -269,7 +269,7 @@ describe('TokenAccessHandler', function() { }) }) - return describe('when the tokens have different lengths', function() { + describe('when the tokens have different lengths', function() { beforeEach(function() { this.project.tokens = { readOnly: 'atntntn', @@ -281,7 +281,7 @@ describe('TokenAccessHandler', function() { .callsArgWith(2, null, this.project)) }) - return it('should not return a project', function(done) { + it('should not return a project', function(done) { return this.TokenAccessHandler.findProjectWithReadAndWriteToken( this.token, function(err, project) { @@ -338,7 +338,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should produce a project object', function(done) { + it('should produce a project object', function(done) { return this.TokenAccessHandler.findProjectWithHigherAccess( this.token, this.userId, @@ -395,7 +395,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should not produce a project', function(done) { + it('should not produce a project', function(done) { return this.TokenAccessHandler.findProjectWithHigherAccess( this.token, this.userId, @@ -415,7 +415,7 @@ describe('TokenAccessHandler', function() { .callsArgWith(2, new Error('woops'))) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.TokenAccessHandler.findProjectWithHigherAccess( this.token, this.userId, @@ -429,7 +429,7 @@ describe('TokenAccessHandler', function() { }) }) - return describe('when isUserInvitedMemberOfProject produces an error', function() { + describe('when isUserInvitedMemberOfProject produces an error', function() { beforeEach(function() { this.Project.findOne = sinon.stub().callsArgWith(2, null, this.project) return (this.CollaboratorsHandler.isUserInvitedMemberOfProject = sinon @@ -437,7 +437,7 @@ describe('TokenAccessHandler', function() { .callsArgWith(2, new Error('woops'))) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.TokenAccessHandler.findProjectWithHigherAccess( this.token, this.userId, @@ -487,14 +487,14 @@ describe('TokenAccessHandler', function() { ) }) - return describe('when Project.update produces an error', function() { + describe('when Project.update produces an error', function() { beforeEach(function() { return (this.Project.update = sinon .stub() .callsArgWith(2, new Error('woops'))) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.TokenAccessHandler.addReadOnlyUserToProject( this.userId, this.projectId, @@ -542,14 +542,14 @@ describe('TokenAccessHandler', function() { ) }) - return describe('when Project.update produces an error', function() { + describe('when Project.update produces an error', function() { beforeEach(function() { return (this.Project.update = sinon .stub() .callsArgWith(2, new Error('woops'))) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.TokenAccessHandler.addReadAndWriteUserToProject( this.userId, this.projectId, @@ -567,7 +567,7 @@ describe('TokenAccessHandler', function() { return (this.req = { session: {}, headers: {} }) }) - return it('should add the token to the session', function(done) { + it('should add the token to the session', function(done) { this.TokenAccessHandler.grantSessionTokenAccess( this.req, this.projectId, @@ -607,7 +607,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should allow read-only access', function(done) { + it('should allow read-only access', function(done) { return this.TokenAccessHandler.isValidToken( this.projectId, this.token, @@ -647,7 +647,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should allow read-and-write access', function(done) { + it('should allow read-and-write access', function(done) { return this.TokenAccessHandler.isValidToken( this.projectId, this.token, @@ -687,7 +687,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should not allow any access', function(done) { + it('should not allow any access', function(done) { return this.TokenAccessHandler.isValidToken( this.projectId, this.token, @@ -727,7 +727,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should produce an error and not allow access', function(done) { + it('should produce an error and not allow access', function(done) { return this.TokenAccessHandler.isValidToken( this.projectId, this.token, @@ -774,7 +774,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should not allow any access', function(done) { + it('should not allow any access', function(done) { return this.TokenAccessHandler.isValidToken( this.projectId, this.token, @@ -788,7 +788,7 @@ describe('TokenAccessHandler', function() { }) }) - return describe('for read-only project', function() { + describe('for read-only project', function() { beforeEach(function() { this.TokenAccessHandler.findProjectWithReadAndWriteToken = sinon .stub() @@ -815,7 +815,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should not allow any access', function(done) { + it('should not allow any access', function(done) { return this.TokenAccessHandler.isValidToken( this.projectId, this.token, @@ -830,7 +830,7 @@ describe('TokenAccessHandler', function() { }) }) - return describe('with nothing', function() { + describe('with nothing', function() { beforeEach(function() { this.TokenAccessHandler.findProjectWithReadAndWriteToken = sinon .stub() @@ -869,7 +869,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should not allow any access', function(done) { + it('should not allow any access', function(done) { return this.TokenAccessHandler.isValidToken( this.projectId, null, @@ -908,7 +908,7 @@ describe('TokenAccessHandler', function() { return expect(this.project.tokens.readOnly).to.equal('') }) - return it('should leave tokens in place for owner', function() { + it('should leave tokens in place for owner', function() { this.TokenAccessHandler.protectTokens(this.project, 'owner') expect(this.project.tokens.readAndWrite).to.equal('rw') return expect(this.project.tokens.readOnly).to.equal('ro') @@ -928,7 +928,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should not check access and return default info', function() { + it('should not check access and return default info', function() { expect(this.V1Api.request.called).to.equal(false) return expect( this.callback.calledWith(null, { @@ -938,7 +938,7 @@ describe('TokenAccessHandler', function() { }) }) - return describe('when v1 api is set', function() { + describe('when v1 api is set', function() { beforeEach(function() { return (this.settings.apis = { v1: 'v1' }) }) @@ -954,7 +954,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should return response body', function() { + it('should return response body', function() { expect( this.V1Api.request.calledWith({ url: `/api/v1/sharelatex/docs/${this.token}/is_published` @@ -966,7 +966,7 @@ describe('TokenAccessHandler', function() { }) }) - return describe('on V1Api.request error', function() { + describe('on V1Api.request error', function() { beforeEach(function() { this.V1Api.request = sinon.stub().callsArgWith(1, 'error') return this.TokenAccessHandler.getV1DocPublishedInfo( @@ -975,14 +975,14 @@ describe('TokenAccessHandler', function() { ) }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback.calledWith('error')).to.equal(true) }) }) }) }) - return describe('getV1DocInfo', function() { + describe('getV1DocInfo', function() { beforeEach(function() { this.v2UserId = 123 return (this.callback = sinon.stub()) @@ -997,7 +997,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should not check access and return default info', function() { + it('should not check access and return default info', function() { expect(this.V1Api.request.called).to.equal(false) return expect( this.callback.calledWith(null, { @@ -1008,7 +1008,7 @@ describe('TokenAccessHandler', function() { }) }) - return describe('when v1 api is set', function() { + describe('when v1 api is set', function() { beforeEach(function() { return (this.settings.apis = { v1: 'v1' }) }) @@ -1025,7 +1025,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should get user', function() { + it('should get user', function() { return expect( this.UserGetter.getUser.calledWith(this.v2UserId) ).to.equal(true) @@ -1043,7 +1043,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback.calledWith(this.error)).to.equal(true) }) }) @@ -1064,7 +1064,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should return response body', function() { + it('should return response body', function() { expect( this.V1Api.request.calledWith({ url: `/api/v1/sharelatex/users/${this.v1UserId}/docs/${ @@ -1078,7 +1078,7 @@ describe('TokenAccessHandler', function() { }) }) - return describe('on V1Api.request error', function() { + describe('on V1Api.request error', function() { beforeEach(function() { this.UserGetter.getUser = sinon.stub().yields(null, { overleaf: { id: 1 } @@ -1091,7 +1091,7 @@ describe('TokenAccessHandler', function() { ) }) - return it('should callback with error', function() { + it('should callback with error', function() { return expect(this.callback.calledWith('error')).to.equal(true) }) }) diff --git a/services/web/test/unit/src/Uploads/ArchiveManagerTests.js b/services/web/test/unit/src/Uploads/ArchiveManagerTests.js index 1d576e164c..cf85dc7c77 100644 --- a/services/web/test/unit/src/Uploads/ArchiveManagerTests.js +++ b/services/web/test/unit/src/Uploads/ArchiveManagerTests.js @@ -86,7 +86,7 @@ describe('ArchiveManager', function() { return this.metrics.Timer.prototype.done.called.should.equal(true) }) - return it('should log the unzip', function() { + it('should log the unzip', function() { return this.logger.log .calledWith(sinon.match.any, 'unzipping file') .should.equal(true) @@ -115,7 +115,7 @@ describe('ArchiveManager', function() { ) }) - return it('should log out the error', function() { + it('should log out the error', function() { return this.logger.error.called.should.equal(true) }) }) @@ -142,7 +142,7 @@ describe('ArchiveManager', function() { ) }) - return it('should not call yauzl.open', function() { + it('should not call yauzl.open', function() { return this.yauzl.open.called.should.equal(false) }) }) @@ -166,7 +166,7 @@ describe('ArchiveManager', function() { .should.equal(true) }) - return it('should log out the error', function() { + it('should log out the error', function() { return this.logger.error.called.should.equal(true) }) }) @@ -190,7 +190,7 @@ describe('ArchiveManager', function() { return this.zipfile.openReadStream.called.should.equal(false) }) - return it('should log out a warning', function() { + it('should log out a warning', function() { return this.logger.warn.called.should.equal(true) }) }) @@ -214,7 +214,7 @@ describe('ArchiveManager', function() { return this.zipfile.openReadStream.called.should.equal(false) }) - return it('should log out a warning', function() { + it('should log out a warning', function() { return this.logger.warn.called.should.equal(true) }) }) @@ -258,7 +258,7 @@ describe('ArchiveManager', function() { ) }) - return it('should treat the backslashes as a directory separator when creating the file', function() { + it('should treat the backslashes as a directory separator when creating the file', function() { this.fs.createWriteStream.should.be.calledWith( `${this.destination}/wombat/foo.tex` ) @@ -287,7 +287,7 @@ describe('ArchiveManager', function() { return this.zipfile.openReadStream.called.should.equal(false) }) - return it('should not log out a warning', function() { + it('should not log out a warning', function() { return this.logger.warn.called.should.equal(false) }) }) @@ -320,7 +320,7 @@ describe('ArchiveManager', function() { return this.logger.error.called.should.equal(true) }) - return it('should close the zipfile', function() { + it('should close the zipfile', function() { return this.zipfile.close.called.should.equal(true) }) }) @@ -358,12 +358,12 @@ describe('ArchiveManager', function() { return this.logger.error.called.should.equal(true) }) - return it('should close the zipfile', function() { + it('should close the zipfile', function() { return this.zipfile.close.called.should.equal(true) }) }) - return describe('with an error in the file write stream', function() { + describe('with an error in the file write stream', function() { beforeEach(function(done) { this.readStream = new events.EventEmitter() this.readStream.pipe = sinon.stub() @@ -406,7 +406,7 @@ describe('ArchiveManager', function() { return this.readStream.destroy.called.should.equal(true) }) - return it('should close the zipfile', function() { + it('should close the zipfile', function() { return this.zipfile.close.called.should.equal(true) }) }) @@ -449,7 +449,7 @@ describe('ArchiveManager', function() { return this.zipfile.emit('end') }) - return it('should return error if there is no data', function(done) { + it('should return error if there is no data', function(done) { this.ArchiveManager._isZipTooLarge(this.source, (error, isTooLarge) => { expect(error).to.exist return done() @@ -458,7 +458,7 @@ describe('ArchiveManager', function() { }) }) - return describe('findTopLevelDirectory', function() { + describe('findTopLevelDirectory', function() { beforeEach(function() { this.fs.readdir = sinon.stub() this.fs.stat = sinon.stub() @@ -478,7 +478,7 @@ describe('ArchiveManager', function() { return this.fs.readdir.calledWith(this.directory).should.equal(true) }) - return it('should return the original directory', function() { + it('should return the original directory', function() { return this.callback.calledWith(null, this.directory).should.equal(true) }) }) @@ -503,12 +503,12 @@ describe('ArchiveManager', function() { .should.equal(true) }) - return it('should return the original directory', function() { + it('should return the original directory', function() { return this.callback.calledWith(null, this.directory).should.equal(true) }) }) - return describe('with a single top-level folder', function() { + describe('with a single top-level folder', function() { beforeEach(function() { this.fs.readdir.callsArgWith(1, null, ['folder']) this.fs.stat.callsArgWith(1, null, { @@ -528,7 +528,7 @@ describe('ArchiveManager', function() { .should.equal(true) }) - return it('should return the child directory', function() { + it('should return the child directory', function() { return this.callback .calledWith(null, this.directory + '/folder') .should.equal(true) diff --git a/services/web/test/unit/src/Uploads/FileSystemImportManagerTests.js b/services/web/test/unit/src/Uploads/FileSystemImportManagerTests.js index 50c6eb6120..20ab1458c2 100644 --- a/services/web/test/unit/src/Uploads/FileSystemImportManagerTests.js +++ b/services/web/test/unit/src/Uploads/FileSystemImportManagerTests.js @@ -78,7 +78,7 @@ describe('FileSystemImportManager', function() { return this.fs.readFile.called.should.equal(false) }) - return it('should not insert the doc', function() { + it('should not insert the doc', function() { return this.EditorController.addDoc.called.should.equal(false) }) }) @@ -102,7 +102,7 @@ describe('FileSystemImportManager', function() { return this.fs.readFile.calledWith(this.path_on_disk).should.equal(true) }) - return it('should insert the doc', function() { + it('should insert the doc', function() { return this.EditorController.addDoc .calledWith( this.project_id, @@ -134,7 +134,7 @@ describe('FileSystemImportManager', function() { ) }) - return it('should strip the \\r characters before adding', function() { + it('should strip the \\r characters before adding', function() { return this.EditorController.addDoc .calledWith( this.project_id, @@ -166,7 +166,7 @@ describe('FileSystemImportManager', function() { ) }) - return it('should treat the \\r characters as newlines', function() { + it('should treat the \\r characters as newlines', function() { return this.EditorController.addDoc .calledWith( this.project_id, @@ -180,7 +180,7 @@ describe('FileSystemImportManager', function() { }) }) - return describe('with replace set to true', function() { + describe('with replace set to true', function() { beforeEach(function() { this.EditorController.upsertDoc = sinon.stub().yields() return this.FileSystemImportManager.addDoc( @@ -208,7 +208,7 @@ describe('FileSystemImportManager', function() { .should.equal(true) }) - return it('should read the file with the correct encoding', function() { + it('should read the file with the correct encoding', function() { return sinon.assert.calledWith( this.fs.readFile, this.path_on_disk, @@ -235,7 +235,7 @@ describe('FileSystemImportManager', function() { ) }) - return it('should add the file', function() { + it('should add the file', function() { return this.EditorController.addFile .calledWith( this.project_id, @@ -268,7 +268,7 @@ describe('FileSystemImportManager', function() { ) }) - return it('should node add the file', function() { + it('should node add the file', function() { this.EditorController.addFile.called.should.equal(false) return this.EditorController.replaceFile.called.should.equal(false) }) @@ -291,7 +291,7 @@ describe('FileSystemImportManager', function() { ) }) - return it('should add the file', function() { + it('should add the file', function() { return this.EditorController.upsertFile .calledWith( this.project_id, @@ -339,7 +339,7 @@ describe('FileSystemImportManager', function() { .should.equal(true) }) - return it('should add the folders contents', function() { + it('should add the folders contents', function() { return this.FileSystemImportManager.addFolderContents .calledWith( this.user_id, @@ -352,7 +352,7 @@ describe('FileSystemImportManager', function() { }) }) - return describe('with symlink', function() { + describe('with symlink', function() { beforeEach(function() { this.FileSystemImportManager._isSafeOnFileSystem = sinon .stub() @@ -368,7 +368,7 @@ describe('FileSystemImportManager', function() { ) }) - return it('should not add a folder to the project', function() { + it('should not add a folder to the project', function() { this.EditorController.addFolder.called.should.equal(false) return this.FileSystemImportManager.addFolderContents.called.should.equal( false @@ -434,12 +434,12 @@ describe('FileSystemImportManager', function() { ) }) - return it('should look in the correct directory', function() { + it('should look in the correct directory', function() { return this.fs.readdir.calledWith(this.path_on_disk).should.equal(true) }) }) - return describe('addEntity', function() { + describe('addEntity', function() { describe('with directory', function() { beforeEach(function() { this.FileTypeManager.isDirectory = sinon @@ -460,7 +460,7 @@ describe('FileSystemImportManager', function() { ) }) - return it('should call addFolder', function() { + it('should call addFolder', function() { return this.FileSystemImportManager.addFolder .calledWith( this.user_id, @@ -495,7 +495,7 @@ describe('FileSystemImportManager', function() { ) }) - return it('should call addFile', function() { + it('should call addFile', function() { return this.FileSystemImportManager.addFile .calledWith( this.user_id, @@ -509,7 +509,7 @@ describe('FileSystemImportManager', function() { }) }) - return describe('with text file', function() { + describe('with text file', function() { beforeEach(function() { this.FileTypeManager.isDirectory = sinon .stub() @@ -532,7 +532,7 @@ describe('FileSystemImportManager', function() { ) }) - return it('should call addFile', function() { + it('should call addFile', function() { return sinon.assert.calledWith( this.FileSystemImportManager.addDoc, this.user_id, diff --git a/services/web/test/unit/src/Uploads/FileTypeManagerTests.js b/services/web/test/unit/src/Uploads/FileTypeManagerTests.js index c311a1c6c2..0ea22457c9 100644 --- a/services/web/test/unit/src/Uploads/FileTypeManagerTests.js +++ b/services/web/test/unit/src/Uploads/FileTypeManagerTests.js @@ -45,18 +45,18 @@ describe('FileTypeManager', function() { return this.FileTypeManager.isDirectory(this.path, this.callback) }) - return it('should return true', function() { + it('should return true', function() { return this.callback.calledWith(null, true).should.equal(true) }) }) - return describe('when it is not a directory', function() { + describe('when it is not a directory', function() { beforeEach(function() { this.stats.isDirectory = sinon.stub().returns(false) return this.FileTypeManager.isDirectory(this.path, this.callback) }) - return it('should return false', function() { + it('should return false', function() { return this.callback.calledWith(null, false).should.equal(true) }) }) @@ -228,7 +228,7 @@ describe('FileTypeManager', function() { ) }) - return it('should detect utf16 with BOM as utf-16', function() { + it('should detect utf16 with BOM as utf-16', function() { return this.FileTypeManager.getType( 'file.tex', '/path/on/disk/utf16.tex', @@ -274,7 +274,7 @@ describe('FileTypeManager', function() { ) }) - return it('should not try to get the character encoding', function() { + it('should not try to get the character encoding', function() { return this.FileTypeManager.getType('file.png', '/path/on/disk', () => { return sinon.assert.notCalled(this.isUtf8) }) diff --git a/services/web/test/unit/src/Uploads/ProjectUploadControllerTests.js b/services/web/test/unit/src/Uploads/ProjectUploadControllerTests.js index 3058dd5dfb..519730ff56 100644 --- a/services/web/test/unit/src/Uploads/ProjectUploadControllerTests.js +++ b/services/web/test/unit/src/Uploads/ProjectUploadControllerTests.js @@ -121,7 +121,7 @@ describe('ProjectUploadController', function() { .should.equal(true) }) - return it('should remove the uploaded file', function() { + it('should remove the uploaded file', function() { return this.fs.unlink.calledWith(this.path).should.equal(true) }) }) @@ -140,14 +140,14 @@ describe('ProjectUploadController', function() { ) }) - return it('should output an error log line', function() { + it('should output an error log line', function() { return this.logger.error .calledWith(sinon.match.any, 'error uploading project') .should.equal(true) }) }) - return describe('when ProjectUploadManager.createProjectFromZipArchive reports the file as invalid', function() { + describe('when ProjectUploadManager.createProjectFromZipArchive reports the file as invalid', function() { beforeEach(function() { this.ProjectUploadManager.createProjectFromZipArchive = sinon .stub() @@ -169,7 +169,7 @@ describe('ProjectUploadController', function() { return expect(this.res.statusCode).to.equal(422) }) - return it('should output an error log line', function() { + it('should output an error log line', function() { return this.logger.error .calledWith(sinon.match.any, 'error uploading project') .should.equal(true) @@ -177,7 +177,7 @@ describe('ProjectUploadController', function() { }) }) - return describe('uploadFile', function() { + describe('uploadFile', function() { beforeEach(function() { this.project_id = 'project-id-123' this.folder_id = 'folder-id-123' @@ -239,7 +239,7 @@ describe('ProjectUploadController', function() { return this.metrics.Timer.prototype.done.called.should.equal(true) }) - return it('should remove the uploaded file', function() { + it('should remove the uploaded file', function() { return this.fs.unlink.calledWith(this.path).should.equal(true) }) }) @@ -258,20 +258,20 @@ describe('ProjectUploadController', function() { }) }) - return it('should output an error log line', function() { + it('should output an error log line', function() { return this.logger.error .calledWith(sinon.match.any, 'error uploading file') .should.equal(true) }) }) - return describe('with a bad request', function() { + describe('with a bad request', function() { beforeEach(function() { this.req.file.originalname = '' return this.ProjectUploadController.uploadFile(this.req, this.res) }) - return it('should return a a non success response', function() { + it('should return a a non success response', function() { return expect(this.res.body).to.deep.equal({ success: false }) diff --git a/services/web/test/unit/src/Uploads/ProjectUploadManagerTests.js b/services/web/test/unit/src/Uploads/ProjectUploadManagerTests.js index 6db7f74dd0..e873d21944 100644 --- a/services/web/test/unit/src/Uploads/ProjectUploadManagerTests.js +++ b/services/web/test/unit/src/Uploads/ProjectUploadManagerTests.js @@ -152,14 +152,14 @@ describe('ProjectUploadManager', function() { .should.equal(true) }) - return it('should ensure the name is valid', function() { + it('should ensure the name is valid', function() { return this.ProjectDetailsHandler.fixProjectName.called.should.equal( true ) }) }) - return describe("when the root document can't be determined", function() { + describe("when the root document can't be determined", function() { beforeEach(function(done) { this.ProjectRootDocManager.findRootDocFileFromDirectory = sinon .stub() @@ -181,7 +181,7 @@ describe('ProjectUploadManager', function() { ) }) - return it('should not try to set the root doc', function() { + it('should not try to set the root doc', function() { return this.ProjectRootDocManager.setRootDocFromName.called.should.equal( false ) @@ -241,7 +241,7 @@ describe('ProjectUploadManager', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback .calledWith(sinon.match.falsy, this.project) .should.equal(true) @@ -299,12 +299,12 @@ describe('ProjectUploadManager', function() { return this.callback.called.should.equal(true) }) - return it('should remove the desintation directory afterwards', function() { + it('should remove the desintation directory afterwards', function() { return this.rimraf.calledWith(this.destination).should.equal(true) }) }) - return describe('_getDestinationDirectory', () => + describe('_getDestinationDirectory', () => it('should return the path with the time appended', function() { const date = Date.now() sinon.stub(Date, 'now', () => date) diff --git a/services/web/test/unit/src/User/UserControllerTests.js b/services/web/test/unit/src/User/UserControllerTests.js index c8707bceaf..1216e3b9c2 100644 --- a/services/web/test/unit/src/User/UserControllerTests.js +++ b/services/web/test/unit/src/User/UserControllerTests.js @@ -158,7 +158,7 @@ describe('UserController', function() { return (this.req.body.password = '') }) - return it('should return 403', function(done) { + it('should return 403', function(done) { this.res.sendStatus = code => { code.should.equal(403) return done() @@ -174,7 +174,7 @@ describe('UserController', function() { .callsArgWith(2, new Error('woops'))) }) - return it('should call next with an error', function(done) { + it('should call next with an error', function(done) { this.next = err => { expect(err).to.not.equal(null) expect(err).to.be.instanceof(Error) @@ -191,7 +191,7 @@ describe('UserController', function() { .callsArgWith(2, null, null)) }) - return it('should return 403', function(done) { + it('should return 403', function(done) { this.res.sendStatus = code => { code.should.equal(403) return done() @@ -207,7 +207,7 @@ describe('UserController', function() { .callsArgWith(1, new Error('woops'))) }) - return it('should call next with an error', function(done) { + it('should call next with an error', function(done) { this.next = err => { expect(err).to.not.equal(null) expect(err).to.be.instanceof(Error) @@ -224,7 +224,7 @@ describe('UserController', function() { .yields(new Errors.SubscriptionAdminDeletionError())) }) - return it('should return a json error', function(done) { + it('should return a json error', function(done) { return this.UserController.tryDeleteUser(this.req, { status(status) { expect(status).to.equal(422) @@ -241,14 +241,14 @@ describe('UserController', function() { }) }) - return describe('when session.destroy produces an error', function() { + describe('when session.destroy produces an error', function() { beforeEach(function() { return (this.req.session.destroy = sinon .stub() .callsArgWith(0, new Error('woops'))) }) - return it('should call next with an error', function(done) { + it('should call next with an error', function(done) { this.next = err => { expect(err).to.not.equal(null) expect(err).to.be.instanceof(Error) @@ -400,7 +400,7 @@ describe('UserController', function() { return this.UserController.updateUserSettings(this.req, this.res) }) - return describe('when using an external auth source', function() { + describe('when using an external auth source', function() { beforeEach(function() { this.UserUpdater.changeEmailAddress.callsArgWith(2) this.newEmail = 'someone23@example.com' @@ -409,7 +409,7 @@ describe('UserController', function() { .returns(true)) }) - return it('should not set a new email', function(done) { + it('should not set a new email', function(done) { this.req.body.email = this.newEmail this.res.sendStatus = code => { code.should.equal(200) @@ -435,7 +435,7 @@ describe('UserController', function() { return this.UserController.logout(this.req, this.res) }) - return it('should clear sudo-mode', function(done) { + it('should clear sudo-mode', function(done) { this.req.session.destroy = sinon.stub().callsArgWith(0) this.SudoModeHandler.clearSudoMode = sinon.stub() this.res.redirect = url => { @@ -466,7 +466,7 @@ describe('UserController', function() { .should.equal(true) }) - return it('should return the user and activation url', function() { + it('should return the user and activation url', function() { return this.res.json .calledWith({ email: this.email, @@ -491,7 +491,7 @@ describe('UserController', function() { return this.UserController.clearSessions(this.req, this.res) }) - return describe('when revokeAllUserSessions produces an error', () => + describe('when revokeAllUserSessions produces an error', () => it('should call next with an error', function(done) { this.UserSessionsManager.revokeAllUserSessions.callsArgWith( 2, @@ -506,7 +506,7 @@ describe('UserController', function() { })) }) - return describe('changePassword', function() { + describe('changePassword', function() { it('should check the old password is the current one at the moment', function(done) { this.AuthenticationManager.authenticate.callsArgWith(2) this.req.body = { currentPassword: 'oldpasshere' } @@ -549,7 +549,7 @@ describe('UserController', function() { return this.UserController.changePassword(this.req, this.res) }) - return it('it should not set the new password if it is invalid', function(done) { + it('it should not set the new password if it is invalid', function(done) { this.AuthenticationManager.validatePassword = sinon .stub() .returns({ message: 'password contains invalid characters' }) diff --git a/services/web/test/unit/src/User/UserCreatorTests.js b/services/web/test/unit/src/User/UserCreatorTests.js index afe9adbdc9..5e723b3d15 100644 --- a/services/web/test/unit/src/User/UserCreatorTests.js +++ b/services/web/test/unit/src/User/UserCreatorTests.js @@ -48,7 +48,7 @@ describe('UserCreator', function() { return (this.email = 'bob.oswald@gmail.com') }) - return describe('createNewUser', function() { + describe('createNewUser', function() { it('should take the opts and put them in the model', function(done) { const opts = { email: this.email, @@ -133,7 +133,7 @@ describe('UserCreator', function() { ) }) - return it('should not add affiliation if skipping', function(done) { + it('should not add affiliation if skipping', function(done) { const attributes = { email: this.email } const options = { skip_affiliation: true } return this.UserCreator.createNewUser( diff --git a/services/web/test/unit/src/User/UserDeleterTests.js b/services/web/test/unit/src/User/UserDeleterTests.js index 94ae46e396..db7703bcc9 100644 --- a/services/web/test/unit/src/User/UserDeleterTests.js +++ b/services/web/test/unit/src/User/UserDeleterTests.js @@ -158,7 +158,7 @@ describe('UserDeleter', function() { }) }) - return it('ensures user can be deleted first', function(done) { + it('ensures user can be deleted first', function(done) { this.UserDeleter._ensureCanDeleteUser.yields( new Errors.SubscriptionAdminDeletionError() ) @@ -257,7 +257,7 @@ describe('UserDeleter', function() { }) }) - return describe('when unsubscribing from mailchimp fails', function() { + describe('when unsubscribing from mailchimp fails', function() { beforeEach(function() { return (this.NewsletterManager.unsubscribe = sinon .stub() @@ -284,7 +284,7 @@ describe('UserDeleter', function() { }) }) - return it('should log an error', function(done) { + it('should log an error', function(done) { return this.UserDeleter.deleteUser(this.user._id, err => { sinon.assert.called(this.logger.err) return done() @@ -293,7 +293,7 @@ describe('UserDeleter', function() { }) }) - return describe('_ensureCanDeleteUser', function() { + describe('_ensureCanDeleteUser', function() { it('should not return error when user can be deleted', function(done) { this.SubscriptionLocator.getUsersSubscription.yields(null, null) return this.UserDeleter._ensureCanDeleteUser(this.user, function(error) { @@ -312,7 +312,7 @@ describe('UserDeleter', function() { }) }) - return it('propagate errors', function(done) { + it('propagate errors', function(done) { this.SubscriptionLocator.getUsersSubscription.yields( new Error('Some error') ) diff --git a/services/web/test/unit/src/User/UserEmailsConfirmationHandlerTests.js b/services/web/test/unit/src/User/UserEmailsConfirmationHandlerTests.js index d221ddc4be..d039a1e375 100644 --- a/services/web/test/unit/src/User/UserEmailsConfirmationHandlerTests.js +++ b/services/web/test/unit/src/User/UserEmailsConfirmationHandlerTests.js @@ -85,7 +85,7 @@ describe('UserEmailsConfirmationHandler', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -99,14 +99,14 @@ describe('UserEmailsConfirmationHandler', function() { ) }) - return it('should return an error', function() { + it('should return an error', function() { return this.callback .calledWith(sinon.match.instanceOf(Error)) .should.equal(true) }) }) - return describe('a custom template', function() { + describe('a custom template', function() { beforeEach(function() { return this.UserEmailsConfirmationHandler.sendConfirmationEmail( this.user_id, @@ -116,7 +116,7 @@ describe('UserEmailsConfirmationHandler', function() { ) }) - return it('should send an email with the given template', function() { + it('should send an email with the given template', function() { return this.EmailHandler.sendEmail .calledWith('myCustomTemplate') .should.equal(true) @@ -124,7 +124,7 @@ describe('UserEmailsConfirmationHandler', function() { }) }) - return describe('confirmEmailFromToken', function() { + describe('confirmEmailFromToken', function() { beforeEach(function() { this.OneTimeTokenHandler.getValueFromTokenAndExpire = sinon .stub() @@ -152,7 +152,7 @@ describe('UserEmailsConfirmationHandler', function() { .should.equal(true) }) - return it('should call the callback', function() { + it('should call the callback', function() { return this.callback.called.should.equal(true) }) }) @@ -168,7 +168,7 @@ describe('UserEmailsConfirmationHandler', function() { ) }) - return it('should call the callback with a NotFoundError', function() { + it('should call the callback with a NotFoundError', function() { return this.callback .calledWith(sinon.match.instanceOf(Errors.NotFoundError)) .should.equal(true) @@ -186,7 +186,7 @@ describe('UserEmailsConfirmationHandler', function() { ) }) - return it('should call the callback with a NotFoundError', function() { + it('should call the callback with a NotFoundError', function() { return this.callback .calledWith(sinon.match.instanceOf(Errors.NotFoundError)) .should.equal(true) @@ -204,14 +204,14 @@ describe('UserEmailsConfirmationHandler', function() { ) }) - return it('should call the callback with a NotFoundError', function() { + it('should call the callback with a NotFoundError', function() { return this.callback .calledWith(sinon.match.instanceOf(Errors.NotFoundError)) .should.equal(true) }) }) - return describe('with no user found', function() { + describe('with no user found', function() { beforeEach(function() { this.UserGetter.getUser.yields(null, null) return this.UserEmailsConfirmationHandler.confirmEmailFromToken( @@ -220,7 +220,7 @@ describe('UserEmailsConfirmationHandler', function() { ) }) - return it('should call the callback with a NotFoundError', function() { + it('should call the callback with a NotFoundError', function() { return this.callback .calledWith(sinon.match.instanceOf(Errors.NotFoundError)) .should.equal(true) diff --git a/services/web/test/unit/src/User/UserEmailsControllerTests.js b/services/web/test/unit/src/User/UserEmailsControllerTests.js index 8c115cd183..da2a2ca6b3 100644 --- a/services/web/test/unit/src/User/UserEmailsControllerTests.js +++ b/services/web/test/unit/src/User/UserEmailsControllerTests.js @@ -64,7 +64,7 @@ describe('UserEmailsController', function() { describe('List', function() { beforeEach(function() {}) - return it('lists emails', function(done) { + it('lists emails', function(done) { const fullEmails = [{ some: 'data' }] this.UserGetter.getUserFullEmails.callsArgWith(1, null, fullEmails) @@ -131,7 +131,7 @@ describe('UserEmailsController', function() { }) }) - return it('handles email parse error', function(done) { + it('handles email parse error', function(done) { this.EmailHelper.parseEmail.returns(null) return this.UserEmailsController.add(this.req, { sendStatus: code => { @@ -167,7 +167,7 @@ describe('UserEmailsController', function() { }) }) - return it('handles email parse error', function(done) { + it('handles email parse error', function(done) { this.EmailHelper.parseEmail.returns(null) return this.UserEmailsController.remove(this.req, { @@ -204,7 +204,7 @@ describe('UserEmailsController', function() { }) }) - return it('handles email parse error', function(done) { + it('handles email parse error', function(done) { this.EmailHelper.parseEmail.returns(null) return this.UserEmailsController.setDefault(this.req, { @@ -224,7 +224,7 @@ describe('UserEmailsController', function() { return this.EmailHelper.parseEmail.returns(this.email) }) - return it('endorses affiliation', function(done) { + it('endorses affiliation', function(done) { this.req.body.role = 'Role' this.req.body.department = 'Department' @@ -244,7 +244,7 @@ describe('UserEmailsController', function() { }) }) - return describe('confirm', function() { + describe('confirm', function() { beforeEach(function() { this.UserEmailsConfirmationHandler.confirmEmailFromToken = sinon .stub() @@ -270,7 +270,7 @@ describe('UserEmailsController', function() { .should.equal(true) }) - return it('should return a 200 status', function() { + it('should return a 200 status', function() { return this.res.sendStatus.calledWith(200).should.equal(true) }) }) @@ -281,12 +281,12 @@ describe('UserEmailsController', function() { return this.UserEmailsController.confirm(this.req, this.res, this.next) }) - return it('should return a 422 status', function() { + it('should return a 422 status', function() { return this.res.sendStatus.calledWith(422).should.equal(true) }) }) - return describe('when confirming fails', function() { + describe('when confirming fails', function() { beforeEach(function() { this.UserEmailsConfirmationHandler.confirmEmailFromToken = sinon .stub() @@ -294,7 +294,7 @@ describe('UserEmailsController', function() { return this.UserEmailsController.confirm(this.req, this.res, this.next) }) - return it('should return a 404 error code with a message', function() { + it('should return a 404 error code with a message', function() { this.res.status.calledWith(404).should.equal(true) return this.res.json .calledWith({ diff --git a/services/web/test/unit/src/User/UserGetterTests.js b/services/web/test/unit/src/User/UserGetterTests.js index 0d5a351a56..c32acac2c8 100644 --- a/services/web/test/unit/src/User/UserGetterTests.js +++ b/services/web/test/unit/src/User/UserGetterTests.js @@ -88,7 +88,7 @@ describe('UserGetter', function() { ) }) - return it('should not allow null query', function(done) { + it('should not allow null query', function(done) { return this.UserGetter.getUser(null, {}, (error, user) => { error.should.exist return done() @@ -178,7 +178,7 @@ describe('UserGetter', function() { ) }) - return it('should get user when it has no emails field', function(done) { + it('should get user when it has no emails field', function(done) { this.fakeUser = { _id: '12390i', email: 'email2@foo.bar' @@ -224,7 +224,7 @@ describe('UserGetter', function() { }) }) - return it('trim email', function(done) { + it('trim email', function(done) { const email = 'hello@world.com' return this.UserGetter.getUserByMainEmail(` ${email} `, (error, user) => { this.findOne.called.should.equal(true) @@ -264,7 +264,7 @@ describe('UserGetter', function() { }) }) - return it('checks main email as well', function(done) { + it('checks main email as well', function(done) { this.findOne.callsArgWith(2, null, null) const email = 'hello@world.com' const projection = { emails: 1 } @@ -302,7 +302,7 @@ describe('UserGetter', function() { ) })) - return describe('ensureUniqueEmailAddress', function() { + describe('ensureUniqueEmailAddress', function() { beforeEach(function() { return (this.UserGetter.getUserByAnyEmail = sinon.stub()) }) @@ -317,7 +317,7 @@ describe('UserGetter', function() { }) }) - return it('should return null if no user is found', function(done) { + it('should return null if no user is found', function(done) { this.UserGetter.getUserByAnyEmail.callsArgWith(1) return this.UserGetter.ensureUniqueEmailAddress(this.newEmail, err => { should.not.exist(err) diff --git a/services/web/test/unit/src/User/UserHandlerTests.js b/services/web/test/unit/src/User/UserHandlerTests.js index 52c7444172..b769d6916e 100644 --- a/services/web/test/unit/src/User/UserHandlerTests.js +++ b/services/web/test/unit/src/User/UserHandlerTests.js @@ -35,12 +35,12 @@ describe('UserHandler', function() { })) }) - return describe('populateTeamInvites', function() { + describe('populateTeamInvites', function() { beforeEach(function(done) { return this.UserHandler.populateTeamInvites(this.user, done) }) - return it('notifies the user about legacy team invites', function() { + it('notifies the user about legacy team invites', function() { return this.TeamInvitesHandler.createTeamInvitesForLegacyInvitedEmail .calledWith(this.user.email) .should.eq(true) diff --git a/services/web/test/unit/src/User/UserInfoControllerTests.js b/services/web/test/unit/src/User/UserInfoControllerTests.js index 86cef9dcfc..bcf44ee451 100644 --- a/services/web/test/unit/src/User/UserInfoControllerTests.js +++ b/services/web/test/unit/src/User/UserInfoControllerTests.js @@ -71,7 +71,7 @@ describe('UserInfoController', function() { ) }) - return it('should call sendFormattedPersonalInfo', function() { + it('should call sendFormattedPersonalInfo', function() { return this.UserInfoController.sendFormattedPersonalInfo .calledWith(this.user, this.res, this.next) .should.equal(true) @@ -102,7 +102,7 @@ describe('UserInfoController', function() { .should.equal(true) }) - return it('should send the formatted details back to the client', function() { + it('should send the formatted details back to the client', function() { return this.UserInfoController.sendFormattedPersonalInfo .calledWith(this.user, this.res, this.next) .should.equal(true) @@ -137,7 +137,7 @@ describe('UserInfoController', function() { .should.equal(true) }) - return it('should send the formatted details back to the client', function() { + it('should send the formatted details back to the client', function() { return this.UserInfoController.sendFormattedPersonalInfo .calledWith(this.user, this.res, this.next) .should.equal(true) @@ -156,12 +156,12 @@ describe('UserInfoController', function() { ) }) - return it('should return 404 to the client', function() { + it('should return 404 to the client', function() { return this.res.statusCode.should.equal(404) }) }) - return describe('when the user id is invalid', function() { + describe('when the user id is invalid', function() { beforeEach(function() { this.user_id = 'invalid' this.req.params = { user_id: this.user_id } @@ -173,7 +173,7 @@ describe('UserInfoController', function() { ) }) - return it('should return 400 to the client', function() { + it('should return 400 to the client', function() { return this.res.statusCode.should.equal(400) }) }) @@ -208,12 +208,12 @@ describe('UserInfoController', function() { .should.equal(true) }) - return it('should send the formatted details back to the client', function() { + it('should send the formatted details back to the client', function() { return this.res.body.should.equal(JSON.stringify(this.formattedInfo)) }) }) - return describe('formatPersonalInfo', () => + describe('formatPersonalInfo', () => it('should return the correctly formatted data', function() { this.user = { _id: ObjectId(), diff --git a/services/web/test/unit/src/User/UserPagesControllerTests.js b/services/web/test/unit/src/User/UserPagesControllerTests.js index 5bb1420cf1..9fd09b8d40 100644 --- a/services/web/test/unit/src/User/UserPagesControllerTests.js +++ b/services/web/test/unit/src/User/UserPagesControllerTests.js @@ -117,7 +117,7 @@ describe('UserPagesController', function() { return this.UserPagesController.registerPage(this.req, this.res) }) - return it('should not set the newTemplateData if there is nothing in the session', function(done) { + it('should not set the newTemplateData if there is nothing in the session', function(done) { this.res.render = (page, opts) => { assert.equal(opts.newTemplateData.templateName, undefined) return done() @@ -135,7 +135,7 @@ describe('UserPagesController', function() { return this.UserPagesController.loginPage(this.req, this.res) }) - return describe('when an explicit redirect is set via query string', function() { + describe('when an explicit redirect is set via query string', function() { beforeEach(function() { this.AuthenticationController._getRedirectFromSession = sinon .stub() @@ -144,7 +144,7 @@ describe('UserPagesController', function() { return (this.req.query.redir = '/somewhere/in/particular') }) - return it('should set a redirect', function(done) { + it('should set a redirect', function(done) { this.res.render = page => { this.AuthenticationController.setRedirectInSession.callCount.should.equal( 1 @@ -184,7 +184,7 @@ describe('UserPagesController', function() { return this.UserPagesController.sessionsPage(this.req, this.res) }) - return describe('when getAllUserSessions produces an error', function() { + describe('when getAllUserSessions produces an error', function() { beforeEach(function() { return this.UserSessionsManager.getAllUserSessions.callsArgWith( 2, @@ -192,7 +192,7 @@ describe('UserPagesController', function() { ) }) - return it('should call next with an error', function(done) { + it('should call next with an error', function(done) { this.next = err => { assert(err !== null) assert(err instanceof Error) @@ -261,7 +261,7 @@ describe('UserPagesController', function() { return delete this.settings.ldap }) - return it('should set "shouldAllowEditingDetails" to false', function(done) { + it('should set "shouldAllowEditingDetails" to false', function(done) { this.res.render = (page, opts) => { opts.shouldAllowEditingDetails.should.equal(false) return done() @@ -270,7 +270,7 @@ describe('UserPagesController', function() { }) }) - return describe('when saml.updateUserDetailsOnLogin is true', function() { + describe('when saml.updateUserDetailsOnLogin is true', function() { beforeEach(function() { return (this.settings.saml = { updateUserDetailsOnLogin: true }) }) @@ -279,7 +279,7 @@ describe('UserPagesController', function() { return delete this.settings.saml }) - return it('should set "shouldAllowEditingDetails" to false', function(done) { + it('should set "shouldAllowEditingDetails" to false', function(done) { this.res.render = (page, opts) => { opts.shouldAllowEditingDetails.should.equal(false) return done() @@ -289,7 +289,7 @@ describe('UserPagesController', function() { }) }) - return describe('activateAccountPage', function() { + describe('activateAccountPage', function() { beforeEach(function() { this.UserGetter.getUser = sinon.stub().callsArgWith(2, null, this.user) this.req.query.user_id = this.user_id @@ -324,7 +324,7 @@ describe('UserPagesController', function() { return this.UserPagesController.activateAccountPage(this.req, this.res) }) - return it('render the activation page if the user has not logged in before', function(done) { + it('render the activation page if the user has not logged in before', function(done) { this.user.loginCount = 0 this.res.render = (page, opts) => { page.should.equal('user/activate') diff --git a/services/web/test/unit/src/User/UserRegistrationHandlerTests.js b/services/web/test/unit/src/User/UserRegistrationHandlerTests.js index a737da3a56..516c3e204f 100644 --- a/services/web/test/unit/src/User/UserRegistrationHandlerTests.js +++ b/services/web/test/unit/src/User/UserRegistrationHandlerTests.js @@ -81,7 +81,7 @@ describe('UserRegistrationHandler', function() { }) }) - return it('does not allow through', function() { + it('does not allow through', function() { const result = this.handler._registrationRequestIsValid( this.passingRequest ) @@ -89,14 +89,14 @@ describe('UserRegistrationHandler', function() { }) }) - return describe('failing password validation', function() { + describe('failing password validation', function() { beforeEach(function() { return this.AuthenticationManager.validatePassword.returns({ message: 'password is too short' }) }) - return it('does not allow through', function() { + it('does not allow through', function() { const result = this.handler._registrationRequestIsValid( this.passingRequest ) @@ -124,7 +124,7 @@ describe('UserRegistrationHandler', function() { }) }) - return it('should set holding account to false', function(done) { + it('should set holding account to false', function(done) { return this.handler.registerNewUser(this.passingRequest, err => { const update = this.User.update.args[0] assert.deepEqual(update[0], { _id: this.user._id }) @@ -144,7 +144,7 @@ describe('UserRegistrationHandler', function() { }) }) - return it('should return email registered in the error if there is a non holdingAccount there', function(done) { + it('should return email registered in the error if there is a non holdingAccount there', function(done) { this.UserGetter.getUserByAnyEmail.callsArgWith( 1, null, @@ -229,7 +229,7 @@ describe('UserRegistrationHandler', function() { }) }) - return it('should track the registration event', function(done) { + it('should track the registration event', function(done) { return this.handler.registerNewUser(this.passingRequest, err => { this.AnalyticsManager.recordEvent .calledWith(this.user._id, 'user-registered') @@ -239,10 +239,10 @@ describe('UserRegistrationHandler', function() { }) }) - return it('should call the ReferalAllocator', done => done()) + it('should call the ReferalAllocator', done => done()) }) - return describe('registerNewUserAndSendActivationEmail', function() { + describe('registerNewUserAndSendActivationEmail', function() { beforeEach(function() { this.email = 'email@example.com' this.crypto.randomBytes = sinon.stub().returns({ @@ -293,7 +293,7 @@ describe('UserRegistrationHandler', function() { .should.equal(true) }) - return it('should return the user', function() { + it('should return the user', function() { return this.callback .calledWith( null, @@ -306,7 +306,7 @@ describe('UserRegistrationHandler', function() { }) }) - return describe('with a user that already exists', function() { + describe('with a user that already exists', function() { beforeEach(function() { this.handler.registerNewUser.callsArgWith( 1, @@ -319,7 +319,7 @@ describe('UserRegistrationHandler', function() { ) }) - return it('should still generate a new password token and email', function() { + it('should still generate a new password token and email', function() { this.OneTimeTokenHandler.getNewToken.called.should.equal(true) return this.EmailHandler.sendEmail.called.should.equal(true) }) diff --git a/services/web/test/unit/src/User/UserSessionsManagerTests.js b/services/web/test/unit/src/User/UserSessionsManagerTests.js index 2d04acd1c6..4d7805bd81 100644 --- a/services/web/test/unit/src/User/UserSessionsManagerTests.js +++ b/services/web/test/unit/src/User/UserSessionsManagerTests.js @@ -132,7 +132,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should not call _checkSessions', function(done) { + it('should not call _checkSessions', function(done) { return this.call(err => { this._checkSessions.callCount.should.equal(0) return done() @@ -169,7 +169,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should not call _checkSessions', function(done) { + it('should not call _checkSessions', function(done) { return this.call(err => { this._checkSessions.callCount.should.equal(0) return done() @@ -177,7 +177,7 @@ describe('UserSessionsManager', function() { }) }) - return describe('when no sessionId is supplied', function() { + describe('when no sessionId is supplied', function() { beforeEach(function() { return (this.call = callback => { return this.UserSessionsManager.trackSession( @@ -206,7 +206,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should not call _checkSessions', function(done) { + it('should not call _checkSessions', function(done) { return this.call(err => { this._checkSessions.callCount.should.equal(0) return done() @@ -271,7 +271,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should not call _checkSessions', function(done) { + it('should not call _checkSessions', function(done) { return this.call(err => { this._checkSessions.callCount.should.equal(0) return done() @@ -308,7 +308,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should not call _checkSessions', function(done) { + it('should not call _checkSessions', function(done) { return this.call(err => { this._checkSessions.callCount.should.equal(0) return done() @@ -316,7 +316,7 @@ describe('UserSessionsManager', function() { }) }) - return describe('when no sessionId is supplied', function() { + describe('when no sessionId is supplied', function() { beforeEach(function() { return (this.call = callback => { return this.UserSessionsManager.untrackSession( @@ -345,7 +345,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should not call _checkSessions', function(done) { + it('should not call _checkSessions', function(done) { return this.call(err => { this._checkSessions.callCount.should.equal(0) return done() @@ -431,7 +431,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should remove all sessions except for the retained one', function(done) { + it('should remove all sessions except for the retained one', function(done) { return this.call(err => { expect(this.rclient.del.firstCall.args[0]).to.deep.equal('sess:one') expect(this.rclient.del.secondCall.args[0]).to.deep.equal( @@ -462,7 +462,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should not call rclient.srem', function(done) { + it('should not call rclient.srem', function(done) { return this.call(err => { this.rclient.srem.callCount.should.equal(0) return done() @@ -489,7 +489,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should not call the appropriate redis methods', function(done) { + it('should not call the appropriate redis methods', function(done) { return this.call(err => { this.rclient.smembers.callCount.should.equal(0) this.rclient.del.callCount.should.equal(0) @@ -499,7 +499,7 @@ describe('UserSessionsManager', function() { }) }) - return describe('when there are no keys to delete', function() { + describe('when there are no keys to delete', function() { beforeEach(function() { return this.rclient.smembers.callsArgWith(1, null, []) }) @@ -512,7 +512,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should not do the delete operation', function(done) { + it('should not do the delete operation', function(done) { return this.call(err => { this.rclient.smembers.callCount.should.equal(1) this.rclient.del.callCount.should.equal(0) @@ -551,7 +551,7 @@ describe('UserSessionsManager', function() { return this.rclient.expire.callsArgWith(2, new Error('woops')) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call(err => { expect(err).to.be.instanceof(Error) return done() @@ -559,7 +559,7 @@ describe('UserSessionsManager', function() { }) }) - return describe('when no user is supplied', function() { + describe('when no user is supplied', function() { beforeEach(function() { return (this.call = callback => { return this.UserSessionsManager.touch(null, callback) @@ -574,7 +574,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should not call expire', function(done) { + it('should not call expire', function(done) { return this.call(err => { this.rclient.expire.callCount.should.equal(0) return done() @@ -663,7 +663,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should not have called rclient.mget', function(done) { + it('should not have called rclient.mget', function(done) { return this.call((err, sessions) => { this.rclient.mget.callCount.should.equal(0) return done() @@ -684,7 +684,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should not have called rclient.mget', function(done) { + it('should not have called rclient.mget', function(done) { return this.call((err, sessions) => { this.rclient.mget.callCount.should.equal(0) return done() @@ -692,14 +692,14 @@ describe('UserSessionsManager', function() { }) }) - return describe('when get produces an error', function() { + describe('when get produces an error', function() { beforeEach(function() { return (this.rclient.get = sinon .stub() .callsArgWith(1, new Error('woops'))) }) - return it('should produce an error', function(done) { + it('should produce an error', function(done) { return this.call((err, sessions) => { expect(err).to.not.equal(null) expect(err).to.be.instanceof(Error) @@ -709,7 +709,7 @@ describe('UserSessionsManager', function() { }) }) - return describe('_checkSessions', function() { + describe('_checkSessions', function() { beforeEach(function() { this.call = callback => { return this.UserSessionsManager._checkSessions(this.user, callback) @@ -751,7 +751,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should remove that key from the set', function(done) { + it('should remove that key from the set', function(done) { return this.call(err => { this.rclient.smembers.callCount.should.equal(1) this.rclient.get.callCount.should.equal(2) @@ -777,7 +777,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should not call redis methods', function(done) { + it('should not call redis methods', function(done) { return this.call(err => { this.rclient.smembers.callCount.should.equal(0) this.rclient.get.callCount.should.equal(0) @@ -786,7 +786,7 @@ describe('UserSessionsManager', function() { }) }) - return describe('when one of the get operations produces an error', function() { + describe('when one of the get operations produces an error', function() { beforeEach(function() { this.rclient.get.onCall(0).callsArgWith(1, new Error('woops'), null) return this.rclient.get.onCall(1).callsArgWith(1, null, null) @@ -799,7 +799,7 @@ describe('UserSessionsManager', function() { }) }) - return it('should call the right redis methods, bailing out early', function(done) { + it('should call the right redis methods, bailing out early', function(done) { return this.call(err => { this.rclient.smembers.callCount.should.equal(1) this.rclient.get.callCount.should.equal(1) diff --git a/services/web/test/unit/src/User/UserUpdaterTests.js b/services/web/test/unit/src/User/UserUpdaterTests.js index e5ace19f11..0010044b22 100644 --- a/services/web/test/unit/src/User/UserUpdaterTests.js +++ b/services/web/test/unit/src/User/UserUpdaterTests.js @@ -117,7 +117,7 @@ describe('UserUpdater', function() { ) }) - return it('handle error', function(done) { + it('handle error', function(done) { this.UserUpdater.removeEmailAddress.callsArgWith(2, new Error('nope')) return this.UserUpdater.changeEmailAddress( this.stubbedUser._id, @@ -216,7 +216,7 @@ describe('UserUpdater', function() { ) }) - return it('validates email', function(done) { + it('validates email', function(done) { return this.UserUpdater.addEmailAddress( this.stubbedUser._id, 'bar', @@ -308,7 +308,7 @@ describe('UserUpdater', function() { ) }) - return it('validates email', function(done) { + it('validates email', function(done) { return this.UserUpdater.removeEmailAddress( this.stubbedUser._id, 'baz', @@ -389,7 +389,7 @@ describe('UserUpdater', function() { ) }) - return it('validates email', function(done) { + it('validates email', function(done) { return this.UserUpdater.setDefaultEmailAddress( this.stubbedUser._id, '.edu', @@ -401,7 +401,7 @@ describe('UserUpdater', function() { }) }) - return describe('confirmEmail', function() { + describe('confirmEmail', function() { beforeEach(function() { return (this.UserUpdater.updateUser = sinon .stub() @@ -491,7 +491,7 @@ describe('UserUpdater', function() { ) }) - return it('refresh features', function(done) { + it('refresh features', function(done) { return this.UserUpdater.confirmEmail( this.stubbedUser._id, this.newEmail, diff --git a/services/web/test/unit/src/UserMembership/UserMembershipAuthorizationTests.js b/services/web/test/unit/src/UserMembership/UserMembershipAuthorizationTests.js index 3be8be0d74..d7418f84f3 100644 --- a/services/web/test/unit/src/UserMembership/UserMembershipAuthorizationTests.js +++ b/services/web/test/unit/src/UserMembership/UserMembershipAuthorizationTests.js @@ -186,7 +186,7 @@ describe('UserMembershipAuthorization', function() { ) }) - return it('checks user is staff if required', function(done) { + it('checks user is staff if required', function(done) { return this.UserMembershipAuthorization.requireInstitutionManagementStaffAccess( this.req, null, @@ -201,7 +201,7 @@ describe('UserMembershipAuthorization', function() { }) }) - return describe('requireEntityAccess', function() { + describe('requireEntityAccess', function() { it('handle team access', function(done) { return this.UserMembershipAuthorization.requireTeamMetricsAccess( this.req, @@ -317,7 +317,7 @@ describe('UserMembershipAuthorization', function() { ) }) - return it('handle graph access', function(done) { + it('handle graph access', function(done) { this.req.query.resource_id = 'mock-resource-id' this.req.query.resource_type = 'institution' const middleware = this.UserMembershipAuthorization.requireGraphAccess diff --git a/services/web/test/unit/src/UserMembership/UserMembershipControllerTests.js b/services/web/test/unit/src/UserMembership/UserMembershipControllerTests.js index df91f0db2e..7444258672 100644 --- a/services/web/test/unit/src/UserMembership/UserMembershipControllerTests.js +++ b/services/web/test/unit/src/UserMembership/UserMembershipControllerTests.js @@ -127,7 +127,7 @@ describe('UserMembershipController', function() { }) }) - return it('render institution view', function(done) { + it('render institution view', function(done) { this.req.entity = this.institution this.req.entityConfig = EntityConfigs.institution return this.UserMembershipController.index(this.req, { @@ -206,7 +206,7 @@ describe('UserMembershipController', function() { }) }) - return it('handle invalid email', function(done) { + it('handle invalid email', function(done) { this.req.body.email = 'not_valid_email' return this.UserMembershipController.add(this.req, { status: () => ({ @@ -261,7 +261,7 @@ describe('UserMembershipController', function() { }) }) - return it('prevent admin removal', function(done) { + it('prevent admin removal', function(done) { this.UserMembershipHandler.removeUser.yields({ isAdmin: true }) return this.UserMembershipController.remove(this.req, { status: () => ({ @@ -305,7 +305,7 @@ describe('UserMembershipController', function() { ) }) - return it('should export the correct csv', function() { + it('should export the correct csv', function() { return assertCalledWith( this.res.send, 'mock-email-1@foo.com\nmock-email-2@foo.com\n' @@ -319,7 +319,7 @@ describe('UserMembershipController', function() { return (this.req.params.id = 'abc') }) - return it('renders view', function(done) { + it('renders view', function(done) { return this.UserMembershipController.new(this.req, { render: (viewPath, data) => { expect(data.entityName).to.eq('publisher') @@ -330,7 +330,7 @@ describe('UserMembershipController', function() { }) }) - return describe('create', function() { + describe('create', function() { beforeEach(function() { this.req.params.name = 'institution' return (this.req.params.id = 123) @@ -350,7 +350,7 @@ describe('UserMembershipController', function() { }) }) - return it('checks canCreate', function(done) { + it('checks canCreate', function(done) { this.req.params.name = 'group' return this.UserMembershipController.create(this.req, null, error => { expect(error).to.extist diff --git a/services/web/test/unit/src/UserMembership/UserMembershipHandlerTests.js b/services/web/test/unit/src/UserMembership/UserMembershipHandlerTests.js index 34cf5f9e4e..9cc9f1802e 100644 --- a/services/web/test/unit/src/UserMembership/UserMembershipHandlerTests.js +++ b/services/web/test/unit/src/UserMembership/UserMembershipHandlerTests.js @@ -148,7 +148,7 @@ describe('UserMembershipHandler', function() { ) }) - return it('handle error', function(done) { + it('handle error', function(done) { this.Subscription.findOne.yields(new Error('some error')) return this.UserMembershipHandler.getEntity( this.fakeEntityId, @@ -198,7 +198,7 @@ describe('UserMembershipHandler', function() { ) }) - return it('handle errors', function(done) { + it('handle errors', function(done) { this.Institution.findOne.yields(new Error('nope')) return this.UserMembershipHandler.getEntity( this.fakeEntityId, @@ -214,7 +214,7 @@ describe('UserMembershipHandler', function() { }) }) - return describe('publishers', () => + describe('publishers', () => it('get publisher', function(done) { return this.UserMembershipHandler.getEntity( this.publisher.slug, @@ -269,7 +269,7 @@ describe('UserMembershipHandler', function() { ) })) - return describe('institution', () => + describe('institution', () => it('build view model for all managers', function(done) { return this.UserMembershipHandler.getUsers( this.institution, @@ -303,7 +303,7 @@ describe('UserMembershipHandler', function() { return (this.email = this.newUser.email) }) - return describe('institution', function() { + describe('institution', function() { it('get user', function(done) { return this.UserMembershipHandler.addUser( this.institution, @@ -358,7 +358,7 @@ describe('UserMembershipHandler', function() { ) }) - return it('return user view', function(done) { + it('return user view', function(done) { return this.UserMembershipHandler.addUser( this.institution, EntityConfigs.institution, @@ -372,7 +372,7 @@ describe('UserMembershipHandler', function() { }) }) - return describe('removeUser', () => + describe('removeUser', () => describe('institution', function() { it('remove user from institution', function(done) { return this.UserMembershipHandler.removeUser( @@ -389,7 +389,7 @@ describe('UserMembershipHandler', function() { ) }) - return it('handle admin', function(done) { + it('handle admin', function(done) { this.subscription.admin_id = this.newUser._id return this.UserMembershipHandler.removeUser( this.subscription, diff --git a/services/web/test/unit/src/UserMembership/UserMembershipViewModelTests.js b/services/web/test/unit/src/UserMembership/UserMembershipViewModelTests.js index b40440df40..15161b93bd 100644 --- a/services/web/test/unit/src/UserMembership/UserMembershipViewModelTests.js +++ b/services/web/test/unit/src/UserMembership/UserMembershipViewModelTests.js @@ -55,7 +55,7 @@ describe('UserMembershipViewModel', function() { }) }) - return it('build user', function() { + it('build user', function() { const viewModel = this.UserMembershipViewModel.build(this.user) expect(viewModel._id).to.equal(this.user._id) expect(viewModel.email).to.equal(this.user.email) @@ -63,7 +63,7 @@ describe('UserMembershipViewModel', function() { }) }) - return describe('build async', function() { + describe('build async', function() { beforeEach(function() { return (this.UserMembershipViewModel.build = sinon.stub()) }) @@ -120,7 +120,7 @@ describe('UserMembershipViewModel', function() { ) }) - return it('build user id with error', function(done) { + it('build user id with error', function(done) { this.UserGetter.getUserOrUserStubById.yields(new Error('nope')) const userId = ObjectId() return this.UserMembershipViewModel.buildAsync( diff --git a/services/web/test/unit/src/UserMembership/UserMembershipsHandlerTests.js b/services/web/test/unit/src/UserMembership/UserMembershipsHandlerTests.js index 24d5113d8a..34ec0b4ec7 100644 --- a/services/web/test/unit/src/UserMembership/UserMembershipsHandlerTests.js +++ b/services/web/test/unit/src/UserMembership/UserMembershipsHandlerTests.js @@ -39,7 +39,7 @@ describe('UserMembershipsHandler', function() { })) }) - return describe('remove user', () => + describe('remove user', () => it('remove user from all entities', function(done) { return this.UserMembershipsHandler.removeUserFromAllEntities( this.user._id, diff --git a/services/web/test/unit/src/infrastructure/CsrfTests.js b/services/web/test/unit/src/infrastructure/CsrfTests.js index 050f3a21c1..35f219f93b 100644 --- a/services/web/test/unit/src/infrastructure/CsrfTests.js +++ b/services/web/test/unit/src/infrastructure/CsrfTests.js @@ -59,7 +59,7 @@ describe('Csrf', function() { return expect(this.next.calledWith(this.err)).to.equal(true) }) - return it('passes the csrf error on when the match is too long', function() { + it('passes the csrf error on when the match is too long', function() { this.csrf.disableDefaultCsrfProtection('/foo/bar/baz', 'POST') this.csrf.middleware(this.req, this.res, this.next) return expect(this.next.calledWith(this.err)).to.equal(true) @@ -75,7 +75,7 @@ describe('Csrf', function() { return expect(this.next.calledWith(this.err)).to.equal(false) }) - return it('passes the csrf error on when the match is not present', function() { + it('passes the csrf error on when the match is not present', function() { this.csrf.disableDefaultCsrfProtection('/url', 'POST') this.csrf.disableDefaultCsrfProtection('/test', 'POST') this.csrf.disableDefaultCsrfProtection('/a/b/c', 'POST') @@ -92,7 +92,7 @@ describe('Csrf', function() { return expect(this.next.calledWith(this.err)).to.equal(true) })) - return describe('when the route is excluded, but the error is not a bad-csrf-token error', () => + describe('when the route is excluded, but the error is not a bad-csrf-token error', () => it('passes the error on', function() { let err this.Csrf = SandboxedModule.require(modulePath, { @@ -122,7 +122,7 @@ describe('Csrf', function() { return expect(this.cb.calledWith(false)).to.equal(true) })) - return describe('when the request is valid', () => + describe('when the request is valid', () => it('calls the callback with `true`', function() { this.Csrf = SandboxedModule.require(modulePath, { requires: { @@ -137,7 +137,7 @@ describe('Csrf', function() { })) }) - return describe('validateToken', function() { + describe('validateToken', function() { describe('when the request is invalid', () => it('calls the callback with `false`', function() { this.cb = sinon.stub() @@ -159,7 +159,7 @@ describe('Csrf', function() { return expect(this.cb.calledWith(true)).to.equal(true) })) - return describe('when there is no token', () => + describe('when there is no token', () => it('calls the callback with `false`', function() { this.Csrf = SandboxedModule.require(modulePath, { requires: { diff --git a/services/web/test/unit/src/infrastructure/GeoIpLookupTests.js b/services/web/test/unit/src/infrastructure/GeoIpLookupTests.js index 6e939d97a5..efe02581bd 100644 --- a/services/web/test/unit/src/infrastructure/GeoIpLookupTests.js +++ b/services/web/test/unit/src/infrastructure/GeoIpLookupTests.js @@ -87,7 +87,7 @@ describe('GeoIpLookup', function() { ) }) - return it('should take the first ip in the string', function(done) { + it('should take the first ip in the string', function(done) { return this.GeoIpLookup.getDetails( ` ${this.ipAddress} 456.312.452.102 432.433.888.234`, err => { @@ -104,7 +104,7 @@ describe('GeoIpLookup', function() { }) }) - return describe('getCurrencyCode', function() { + describe('getCurrencyCode', function() { it('should return GBP for GB country', function(done) { this.GeoIpLookup.getDetails = sinon .stub() @@ -182,7 +182,7 @@ describe('GeoIpLookup', function() { }) }) - return it('should default to USD if there is no match for their country', function(done) { + it('should default to USD if there is no match for their country', function(done) { this.stubbedResponse.country_code = 'Non existant' this.GeoIpLookup.getDetails = sinon .stub() diff --git a/services/web/test/unit/src/infrastructure/LockManager/ReleasingTheLock.js b/services/web/test/unit/src/infrastructure/LockManager/ReleasingTheLock.js index 9f0d1c1564..f4715e3db3 100644 --- a/services/web/test/unit/src/infrastructure/LockManager/ReleasingTheLock.js +++ b/services/web/test/unit/src/infrastructure/LockManager/ReleasingTheLock.js @@ -40,7 +40,7 @@ describe('LockManager - releasing the lock', function() { const LockManager = SandboxedModule.require(modulePath, { requires: mocks }) LockManager.unlockScript = 'this is the unlock script' - return it('should put a all data into memory', done => + it('should put a all data into memory', done => LockManager._releaseLock(lockKey, lockValue, function() { deleteStub .calledWith(LockManager.unlockScript, 1, lockKey, lockValue) diff --git a/services/web/test/unit/src/infrastructure/LockManager/getLockTests.js b/services/web/test/unit/src/infrastructure/LockManager/getLockTests.js index a726e91ef6..7b2c907586 100644 --- a/services/web/test/unit/src/infrastructure/LockManager/getLockTests.js +++ b/services/web/test/unit/src/infrastructure/LockManager/getLockTests.js @@ -67,7 +67,7 @@ describe('LockManager - getting the lock', function() { return this.LockManager._tryLock.callCount.should.equal(1) }) - return it('should return the callback', function() { + it('should return the callback', function() { return this.callback.calledWith(null).should.equal(true) }) }) @@ -100,7 +100,7 @@ describe('LockManager - getting the lock', function() { return (this.LockManager._tryLock.callCount > 1).should.equal(true) }) - return it('should return the callback', function() { + it('should return the callback', function() { return this.callback.calledWith(null).should.equal(true) }) }) @@ -116,12 +116,12 @@ describe('LockManager - getting the lock', function() { }) }) - return it('should return the callback with an error', function() { + it('should return the callback with an error', function() { return this.callback.calledWith(new Error('timeout')).should.equal(true) }) }) - return describe('when there are multiple requests for the same lock', function() { + describe('when there are multiple requests for the same lock', function() { beforeEach(function(done) { let locked = false this.results = [] @@ -168,7 +168,7 @@ describe('LockManager - getting the lock', function() { ) }) - return it('should process the requests in order', function() { + it('should process the requests in order', function() { return this.results.should.deep.equal([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) }) }) diff --git a/services/web/test/unit/src/infrastructure/LockManager/tryLockTests.js b/services/web/test/unit/src/infrastructure/LockManager/tryLockTests.js index 1d1b191292..7235a2f3d5 100644 --- a/services/web/test/unit/src/infrastructure/LockManager/tryLockTests.js +++ b/services/web/test/unit/src/infrastructure/LockManager/tryLockTests.js @@ -59,18 +59,18 @@ describe('LockManager - trying the lock', function() { .should.equal(true) }) - return it('should return the callback with true', function() { + it('should return the callback with true', function() { return this.callback.calledWith(null, true).should.equal(true) }) }) - return describe('when the lock is already set', function() { + describe('when the lock is already set', function() { beforeEach(function() { this.set.callsArgWith(5, null, null) return this.LockManager._tryLock(this.key, this.namespace, this.callback) }) - return it('should return the callback with false', function() { + it('should return the callback with false', function() { return this.callback.calledWith(null, false).should.equal(true) }) }) diff --git a/services/web/test/unit/src/infrastructure/ProxyManagerTests.js b/services/web/test/unit/src/infrastructure/ProxyManagerTests.js index 166ce5946a..587fbffd7d 100644 --- a/services/web/test/unit/src/infrastructure/ProxyManagerTests.js +++ b/services/web/test/unit/src/infrastructure/ProxyManagerTests.js @@ -55,7 +55,7 @@ describe('ProxyManager', function() { return assertCalledWith(this.router.get, '/foo/:id') }) - return it('applies methods other than get', function() { + it('applies methods other than get', function() { this.router = { post: sinon.stub(), put: sinon.stub() @@ -72,7 +72,7 @@ describe('ProxyManager', function() { }) }) - return describe('createProxy', function() { + describe('createProxy', function() { beforeEach(function() { this.req.url = this.proxyPath this.req.route.path = this.proxyPath @@ -188,7 +188,7 @@ describe('ProxyManager', function() { }) }) - return it('passes body for put', function() { + it('passes body for put', function() { const target = { baseUrl: 'api.v1', path: '/foo', diff --git a/services/web/test/unit/src/infrastructure/RateLimterTests.js b/services/web/test/unit/src/infrastructure/RateLimterTests.js index 42064a0338..ccec323bb8 100644 --- a/services/web/test/unit/src/infrastructure/RateLimterTests.js +++ b/services/web/test/unit/src/infrastructure/RateLimterTests.js @@ -87,7 +87,7 @@ describe('RateLimiter', function() { }) }) - return it('should not increment the metric', function(done) { + it('should not increment the metric', function(done) { return this.limiter.addCount( { endpointName: this.endpointName }, (err, should) => { @@ -122,7 +122,7 @@ describe('RateLimiter', function() { }) }) - return it('should increment the metric', function(done) { + it('should increment the metric', function(done) { return this.limiter.addCount( { endpointName: this.endpointName }, (err, should) => { @@ -138,7 +138,7 @@ describe('RateLimiter', function() { }) }) - return describe('when limiter produces an error', function() { + describe('when limiter produces an error', function() { beforeEach(function() { this.requires['rolling-rate-limiter'] = opts => { return sinon.stub().callsArgWith(1, new Error('woops')) @@ -148,7 +148,7 @@ describe('RateLimiter', function() { })) }) - return it('should produce and error', function(done) { + it('should produce and error', function(done) { return this.limiter.addCount({}, function(err, should) { expect(err).to.not.equal(null) expect(err).to.be.instanceof(Error) diff --git a/services/web/test/unit/src/infrastructure/RedisWrapperTests.js b/services/web/test/unit/src/infrastructure/RedisWrapperTests.js index c785941ed4..259f452f6d 100644 --- a/services/web/test/unit/src/infrastructure/RedisWrapperTests.js +++ b/services/web/test/unit/src/infrastructure/RedisWrapperTests.js @@ -30,7 +30,7 @@ describe('RedisWrapper', function() { })) }) - return describe('client', function() { + describe('client', function() { it('should use the feature settings if present', function() { this.settings.redis = { my_feature: { @@ -45,7 +45,7 @@ describe('RedisWrapper', function() { .should.equal(true) }) - return it('should use the web settings if feature not present', function() { + it('should use the web settings if feature not present', function() { this.settings.redis = { web: { port: '43', diff --git a/services/web/test/unit_frontend/src/ide/editor/aceEditor/spell-check/SpellCheckManagerTests.js b/services/web/test/unit_frontend/src/ide/editor/aceEditor/spell-check/SpellCheckManagerTests.js index 6e77e4a527..a4a94f0981 100644 --- a/services/web/test/unit_frontend/src/ide/editor/aceEditor/spell-check/SpellCheckManagerTests.js +++ b/services/web/test/unit_frontend/src/ide/editor/aceEditor/spell-check/SpellCheckManagerTests.js @@ -52,7 +52,7 @@ define([ return this.timelord.restore() }) - return it('runs a full check soon after init', function() { + it('runs a full check soon after init', function() { this.$httpBackend.when('POST', '/spelling/check').respond({ misspellings: [ { diff --git a/services/web/test/unit_frontend/src/ide/history/util/displayNameForUserTests.js b/services/web/test/unit_frontend/src/ide/history/util/displayNameForUserTests.js index 6372e2ea8c..6594926059 100644 --- a/services/web/test/unit_frontend/src/ide/history/util/displayNameForUserTests.js +++ b/services/web/test/unit_frontend/src/ide/history/util/displayNameForUserTests.js @@ -56,7 +56,7 @@ define(['ide/history/util/displayNameForUser'], displayNameForUser => }) ).to.equal('james.allen')) - return it("should return the '?' if it has nothing", () => + it("should return the '?' if it has nothing", () => expect( displayNameForUser({ id: window.user.id + 1, diff --git a/services/web/test/unit_frontend/src/utils/EventEmitterTests.js b/services/web/test/unit_frontend/src/utils/EventEmitterTests.js index f5de245cab..3307019b51 100644 --- a/services/web/test/unit_frontend/src/utils/EventEmitterTests.js +++ b/services/web/test/unit_frontend/src/utils/EventEmitterTests.js @@ -72,7 +72,7 @@ define(['utils/EventEmitter'], EventEmitter => return expect(cb).to.not.have.been.called }) - return it('does not remove unnamespaced listeners if off called with namespace', function() { + it('does not remove unnamespaced listeners if off called with namespace', function() { const cb1 = sinon.stub() const cb2 = sinon.stub() this.eventEmitter.on('foo', cb1)