Merge pull request #2583 from overleaf/spd-no-mongoredis-in-unittests
Clean up attempts to connect to Mongo and Redis in unit tests GitOrigin-RevId: 396813a04fc2aaf39a07e28613f8f1e0a7a2db8f
This commit is contained in:
committed by
Copybot
parent
5c7251afce
commit
96cd1c869e
@@ -1,65 +0,0 @@
|
||||
/* eslint-disable
|
||||
max-len,
|
||||
no-return-assign,
|
||||
no-unused-vars,
|
||||
*/
|
||||
// TODO: This file was created by bulk-decaffeinate.
|
||||
// Fix any style issues and re-enable lint.
|
||||
/*
|
||||
* decaffeinate suggestions:
|
||||
* DS102: Remove unnecessary code created because of implicit returns
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const { assert } = require('chai')
|
||||
const sinon = require('sinon')
|
||||
const chai = require('chai')
|
||||
const should = chai.should()
|
||||
const { expect } = chai
|
||||
const modulePath = '../../../../app/src/infrastructure/RedisWrapper.js'
|
||||
const SandboxedModule = require('sandboxed-module')
|
||||
|
||||
describe('RedisWrapper', function() {
|
||||
beforeEach(function() {
|
||||
this.settings = { redis: {} }
|
||||
this.redis = { createClient: sinon.stub() }
|
||||
return (this.RedisWrapper = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
'redis-sharelatex': this.redis
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
||||
describe('client', function() {
|
||||
it('should use the feature settings if present', function() {
|
||||
this.settings.redis = {
|
||||
my_feature: {
|
||||
port: '23456',
|
||||
host: 'otherhost',
|
||||
password: 'banana'
|
||||
}
|
||||
}
|
||||
this.RedisWrapper.client('my_feature')
|
||||
return this.redis.createClient
|
||||
.calledWith(this.settings.redis.my_feature)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
it('should use the web settings if feature not present', function() {
|
||||
this.settings.redis = {
|
||||
web: {
|
||||
port: '43',
|
||||
host: 'otherhost',
|
||||
password: 'banana'
|
||||
}
|
||||
}
|
||||
this.RedisWrapper.client('my_feature')
|
||||
return this.redis.createClient
|
||||
.calledWith(this.settings.redis.web)
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user