LEFT | RIGHT |
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 (function() { | 3 (function() { |
4 | 4 |
5 // Helpers | 5 // Helpers |
6 // Verify that an expected Error was found. | 6 // Verify that an expected Error was found. |
7 var ERROR = function(errString, done) { | 7 var ERROR = function(errString, done) { |
8 return function(result) { | 8 return function(result) { |
9 assert.equal(errString, result.error); | 9 assert.equal(errString, result.error); |
10 done(); | 10 done(); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 result = fakebackend.getService('wordpress'); | 408 result = fakebackend.getService('wordpress'); |
409 assert.equal(result.error, 'Invalid service id.'); | 409 assert.equal(result.error, 'Invalid service id.'); |
410 // But the other one exists and has no relations. | 410 // But the other one exists and has no relations. |
411 mysql = fakebackend.getService('mysql').result; | 411 mysql = fakebackend.getService('mysql').result; |
412 assert.lengthOf(mysql.rels, 0); | 412 assert.lengthOf(mysql.rels, 0); |
413 done(); | 413 done(); |
414 }); | 414 }); |
415 }); | 415 }); |
416 }); | 416 }); |
417 | 417 |
| 418 it('removes units when destroying a service', function(done) { |
| 419 fakebackend.deploy('cs:wordpress', function(data) { |
| 420 var service = fakebackend.db.services.getById('wordpress'); |
| 421 var units = fakebackend.db.units.get_units_for_service(service); |
| 422 assert.lengthOf(units, 1); |
| 423 var result = fakebackend.destroyService('wordpress'); |
| 424 assert.equal(result.result, 'wordpress'); |
| 425 assert.isUndefined(result.error); |
| 426 units = fakebackend.db.units.get_units_for_service(service); |
| 427 assert.lengthOf(units, 0); |
| 428 done(); |
| 429 }); |
| 430 }); |
| 431 |
418 }); | 432 }); |
419 | 433 |
420 describe('FakeBackend.Annotations', function() { | 434 describe('FakeBackend.Annotations', function() { |
421 it('must require authentication', function() { | 435 it('must require authentication', function() { |
422 fakebackend.logout(); | 436 fakebackend.logout(); |
423 var reply = fakebackend.getAnnotations('env'); | 437 var reply = fakebackend.getAnnotations('env'); |
424 assert.equal(reply.error, 'Please log in.'); | 438 assert.equal(reply.error, 'Please log in.'); |
425 }); | 439 }); |
426 | 440 |
427 it('must get annotations from a service', function(done) { | 441 it('must get annotations from a service', function(done) { |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 | 841 |
828 it('can create a relation with an inferred interface', function() { | 842 it('can create a relation with an inferred interface', function() { |
829 // TODO | 843 // TODO |
830 }); | 844 }); |
831 | 845 |
832 | 846 |
833 }); | 847 }); |
834 | 848 |
835 | 849 |
836 })(); | 850 })(); |
LEFT | RIGHT |