|
@@ -15,6 +15,7 @@
|
|
|
const SandboxedModule = require('sandboxed-module')
|
|
const SandboxedModule = require('sandboxed-module')
|
|
|
const { assert, expect } = require('chai')
|
|
const { assert, expect } = require('chai')
|
|
|
const sinon = require('sinon')
|
|
const sinon = require('sinon')
|
|
|
|
|
+const Errors = require('../../../../app/src/Features/Errors/Errors')
|
|
|
const modulePath = '../../../../app/src/Features/References/ReferencesHandler'
|
|
const modulePath = '../../../../app/src/Features/References/ReferencesHandler'
|
|
|
|
|
|
|
|
describe('ReferencesHandler', function () {
|
|
describe('ReferencesHandler', function () {
|
|
@@ -206,6 +207,28 @@ describe('ReferencesHandler', function () {
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ describe('when ProjectGetter.getProject returns null', function () {
|
|
|
|
|
+ beforeEach(function () {
|
|
|
|
|
+ return this.ProjectGetter.getProject.callsArgWith(2, null)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should produce an error', function (done) {
|
|
|
|
|
+ return this.call((err, data) => {
|
|
|
|
|
+ expect(err).to.not.equal(null)
|
|
|
|
|
+ expect(err).to.be.instanceof(Errors.NotFoundError)
|
|
|
|
|
+ expect(data).to.equal(undefined)
|
|
|
|
|
+ return done()
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should not send request', function (done) {
|
|
|
|
|
+ return this.call((err, data) => {
|
|
|
|
|
+ this.request.post.callCount.should.equal(0)
|
|
|
|
|
+ return done()
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
describe('when _isFullIndex produces an error', function () {
|
|
describe('when _isFullIndex produces an error', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
this.ProjectGetter.getProject.callsArgWith(2, null, this.fakeProject)
|
|
this.ProjectGetter.getProject.callsArgWith(2, null, this.fakeProject)
|
|
@@ -389,6 +412,28 @@ describe('ReferencesHandler', function () {
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ describe('when ProjectGetter.getProject returns null', function () {
|
|
|
|
|
+ beforeEach(function () {
|
|
|
|
|
+ return this.ProjectGetter.getProject.callsArgWith(2, null)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should produce an error', function (done) {
|
|
|
|
|
+ return this.call((err, data) => {
|
|
|
|
|
+ expect(err).to.not.equal(null)
|
|
|
|
|
+ expect(err).to.be.instanceof(Errors.NotFoundError)
|
|
|
|
|
+ expect(data).to.equal(undefined)
|
|
|
|
|
+ return done()
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should not send request', function (done) {
|
|
|
|
|
+ return this.call((err, data) => {
|
|
|
|
|
+ this.request.post.callCount.should.equal(0)
|
|
|
|
|
+ return done()
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
describe('when _isFullIndex produces an error', function () {
|
|
describe('when _isFullIndex produces an error', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
this.ProjectGetter.getProject.callsArgWith(2, null, this.fakeProject)
|
|
this.ProjectGetter.getProject.callsArgWith(2, null, this.fakeProject)
|