Merge pull request #4799 from overleaf/hb-eslint-rules

Re-enable some eslint rules

GitOrigin-RevId: 16153adb839bb61784bb40fbc8e43da281fe090d
This commit is contained in:
Hugh O'Brien
2021-09-15 08:03:43 +00:00
committed by Copybot
parent 49b1356976
commit f7900b474b
26 changed files with 136 additions and 82 deletions
@@ -1,4 +1,5 @@
const SandboxedModule = require('sandboxed-module')
const assert = require('assert')
const sinon = require('sinon')
const modulePath = require('path').join(
__dirname,
@@ -374,6 +375,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.userHasV2Subscription(
this.user,
(err, hasSubscription) => {
assert.equal(err, null)
hasSubscription.should.equal(true)
done()
}
@@ -386,6 +388,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.userHasV2Subscription(
this.user,
(err, hasSubscription) => {
assert.equal(err, null)
hasSubscription.should.equal(false)
done()
}
@@ -397,6 +400,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.userHasV2Subscription(
this.user,
(err, hasSubscription) => {
assert.equal(err, null)
hasSubscription.should.equal(false)
done()
}
@@ -413,6 +417,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.userHasV2Subscription(
this.user,
(err, hasSubOrIsGroupMember, subscription) => {
assert.equal(err, null)
subscription.should.deep.equal(stubbedSubscription)
done()
}
@@ -433,6 +438,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.userHasV2Subscription(
this.user,
(err, hasSubscription, subscription) => {
assert.equal(err, null)
hasSubscription.should.equal(true)
done()
}
@@ -443,6 +449,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.userHasV2Subscription(
this.user,
(err, hasSubscription, subscription) => {
assert.equal(err, null)
subscription.should.deep.equal(this.fakeSubscription)
done()
}
@@ -461,6 +468,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.userIsMemberOfGroupSubscription(
this.user,
(err, isMember) => {
assert.equal(err, null)
isMember.should.equal(false)
done()
}
@@ -477,6 +485,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.userIsMemberOfGroupSubscription(
this.user,
(err, isMember, retSubscriptions) => {
assert.equal(err, null)
isMember.should.equal(true)
retSubscriptions.should.equal(subscriptions)
done()
@@ -505,6 +514,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.hasPaidSubscription(
this.user,
(err, hasSubOrIsGroupMember) => {
assert.equal(err, null)
hasSubOrIsGroupMember.should.equal(true)
done()
}
@@ -518,6 +528,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.hasPaidSubscription(
this.user,
(err, hasSubOrIsGroupMember) => {
assert.equal(err, null)
hasSubOrIsGroupMember.should.equal(true)
done()
}
@@ -531,6 +542,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.hasPaidSubscription(
this.user,
(err, hasSubOrIsGroupMember) => {
assert.equal(err, null)
hasSubOrIsGroupMember.should.equal(true)
done()
}
@@ -541,6 +553,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.hasPaidSubscription(
this.user,
(err, hasSubOrIsGroupMember) => {
assert.equal(err, null)
hasSubOrIsGroupMember.should.equal(false)
done()
}
@@ -551,6 +564,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.userHasSubscriptionOrIsGroupMember(
this.user,
(err, hasSubOrIsGroupMember) => {
assert.equal(err, null)
hasSubOrIsGroupMember.should.equal(false)
done()
}
@@ -575,6 +589,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.userHasV1OrV2Subscription(
this.user,
(err, hasSub) => {
assert.equal(err, null)
hasSub.should.equal(true)
done()
}
@@ -588,6 +603,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.userHasV1OrV2Subscription(
this.user,
(err, hasSub) => {
assert.equal(err, null)
hasSub.should.equal(true)
done()
}
@@ -598,6 +614,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.userHasV1OrV2Subscription(
this.user,
(err, hasSub) => {
assert.equal(err, null)
hasSub.should.equal(false)
done()
}
@@ -626,6 +643,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.hasGroupMembersLimitReached(
this.subscriptionId,
(err, limitReached) => {
assert.equal(err, null)
limitReached.should.equal(true)
done()
}
@@ -642,6 +660,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.hasGroupMembersLimitReached(
this.subscriptionId,
(err, limitReached) => {
assert.equal(err, null)
limitReached.should.equal(false)
done()
}
@@ -658,6 +677,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.hasGroupMembersLimitReached(
this.subscriptionId,
(err, limitReached) => {
assert.equal(err, null)
limitReached.should.equal(true)
done()
}
@@ -673,6 +693,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.userHasV1Subscription(
this.user,
(error, result) => {
assert.equal(error, null)
this.V1SubscriptionManager.getSubscriptionsFromV1
.calledWith(this.userId)
.should.equal(true)
@@ -689,6 +710,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.userHasV1Subscription(
this.user,
(error, result) => {
assert.equal(error, null)
this.V1SubscriptionManager.getSubscriptionsFromV1
.calledWith(this.userId)
.should.equal(true)
@@ -705,6 +727,7 @@ describe('LimitationsManager', function () {
this.LimitationsManager.userHasV1Subscription(
this.user,
(error, result) => {
assert.equal(error, null)
this.V1SubscriptionManager.getSubscriptionsFromV1
.calledWith(this.userId)
.should.equal(true)
@@ -1,5 +1,6 @@
const SandboxedModule = require('sandboxed-module')
const { expect } = require('chai')
const assert = require('assert')
const sinon = require('sinon')
const modulePath =
'../../../../app/src/Features/Subscription/UserFeaturesUpdater'
@@ -46,6 +47,7 @@ describe('UserFeaturesUpdater', function () {
(err, features) => {
const updateArgs = this.User.findByIdAndUpdate.lastCall.args
expect(updateArgs[0]).to.deep.equal(userId)
assert.equal(err, null)
expect(Object.keys(updateArgs[1]).length).to.equal(3)
expect(updateArgs[1]['features.versioning']).to.equal(
update.versioning
@@ -69,6 +71,7 @@ describe('UserFeaturesUpdater', function () {
userId,
update,
(err, featuresChanged) => {
assert.equal(err, null)
const updateArgs = this.User.findByIdAndUpdate.lastCall.args
expect(updateArgs[0]).to.equal(userId)
expect(Object.keys(updateArgs[1]).length).to.equal(2)
@@ -61,6 +61,7 @@ describe('GeoIpLookup', function () {
describe('callback', function () {
it('should request the details using the ip', function (done) {
this.GeoIpLookup.getDetails(this.ipAddress, err => {
assert.equal(err, null)
this.request.get
.calledWith({
url: this.settings.apis.geoIpLookup.url + '/' + this.ipAddress,
@@ -74,6 +75,7 @@ describe('GeoIpLookup', function () {
it('should return the ip details', function (done) {
this.GeoIpLookup.getDetails(this.ipAddress, (err, returnedDetails) => {
assert.equal(err, null)
assert.deepEqual(returnedDetails, this.stubbedResponse)
done()
})
@@ -83,6 +85,7 @@ describe('GeoIpLookup', function () {
this.GeoIpLookup.getDetails(
` ${this.ipAddress} 123.123.123.123 234.234.234.234`,
err => {
assert.equal(err, null)
this.request.get
.calledWith({
url: this.settings.apis.geoIpLookup.url + '/' + this.ipAddress,
@@ -137,6 +140,7 @@ describe('GeoIpLookup', function () {
this.GeoIpLookup.getCurrencyCode(
this.ipAddress,
(err, currencyCode) => {
assert.equal(err, null)
currencyCode.should.equal('GBP')
done()
}
@@ -149,6 +153,7 @@ describe('GeoIpLookup', function () {
this.GeoIpLookup.getCurrencyCode(
this.ipAddress,
(err, currencyCode) => {
assert.equal(err, null)
currencyCode.should.equal('GBP')
done()
}
@@ -161,6 +166,7 @@ describe('GeoIpLookup', function () {
this.GeoIpLookup.getCurrencyCode(
this.ipAddress,
(err, currencyCode) => {
assert.equal(err, null)
currencyCode.should.equal('USD')
done()
}
@@ -173,6 +179,7 @@ describe('GeoIpLookup', function () {
this.GeoIpLookup.getCurrencyCode(
this.ipAddress,
(err, currencyCode) => {
assert.equal(err, null)
currencyCode.should.equal('EUR')
done()
}
@@ -184,6 +191,7 @@ describe('GeoIpLookup', function () {
this.GeoIpLookup.getCurrencyCode(
this.ipAddress,
(err, currencyCode) => {
assert.equal(err, null)
currencyCode.should.equal('USD')
done()
}
@@ -195,6 +203,7 @@ describe('GeoIpLookup', function () {
this.GeoIpLookup.getCurrencyCode(
this.ipAddress,
(err, currencyCode) => {
assert.equal(err, null)
currencyCode.should.equal('USD')
done()
}
@@ -207,6 +216,7 @@ describe('GeoIpLookup', function () {
this.GeoIpLookup.getCurrencyCode(
this.ipAddress,
(err, currencyCode) => {
assert.equal(err, null)
currencyCode.should.equal('USD')
done()
}