|
|
@@ -214,6 +214,50 @@ describe('ClsiManager', function() {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
+ describe('with an unavailable response', function() {
|
|
|
+ beforeEach(function() {
|
|
|
+ this.ClsiManager.sendRequestOnce = sinon.stub()
|
|
|
+ this.ClsiManager.sendRequestOnce
|
|
|
+ .withArgs(this.project_id, this.user_id, {
|
|
|
+ syncType: 'full',
|
|
|
+ forceNewClsiServer: true
|
|
|
+ })
|
|
|
+ .callsArgWith(3, null, (this.status = 'success'))
|
|
|
+ this.ClsiManager.sendRequestOnce
|
|
|
+ .withArgs(this.project_id, this.user_id, {})
|
|
|
+ .callsArgWith(3, null, 'unavailable')
|
|
|
+ this.ClsiManager.sendRequest(
|
|
|
+ this.project_id,
|
|
|
+ this.user_id,
|
|
|
+ {},
|
|
|
+ this.callback
|
|
|
+ )
|
|
|
+ })
|
|
|
+
|
|
|
+ it('should call the sendRequestOnce method twice', function() {
|
|
|
+ this.ClsiManager.sendRequestOnce.calledTwice.should.equal(true)
|
|
|
+ })
|
|
|
+
|
|
|
+ it('should call the sendRequestOnce method with forceNewClsiServer:true', function() {
|
|
|
+ this.ClsiManager.sendRequestOnce
|
|
|
+ .calledWith(this.project_id, this.user_id, {
|
|
|
+ forceNewClsiServer: true,
|
|
|
+ syncType: 'full'
|
|
|
+ })
|
|
|
+ .should.equal(true)
|
|
|
+ })
|
|
|
+
|
|
|
+ it('should call the sendRequestOnce method without forceNewClsiServer:true', function() {
|
|
|
+ this.ClsiManager.sendRequestOnce
|
|
|
+ .calledWith(this.project_id, this.user_id, {})
|
|
|
+ .should.equal(true)
|
|
|
+ })
|
|
|
+
|
|
|
+ it('should call the callback with a success status', function() {
|
|
|
+ this.callback.calledWith(null, this.status).should.equal(true)
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
describe('when the resources fail the precompile check', function() {
|
|
|
beforeEach(function() {
|
|
|
this.ClsiFormatChecker.checkRecoursesForProblems = sinon
|