OLD | NEW |
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 describe('charm normalization', function() { | 3 describe('charm normalization', function() { |
4 var models; | 4 var models; |
5 | 5 |
6 before(function(done) { | 6 before(function(done) { |
7 YUI(GlobalConfig).use('juju-models', 'juju-charm-models', function(Y) { | 7 YUI(GlobalConfig).use('juju-models', 'juju-charm-models', function(Y) { |
8 models = Y.namespace('juju.models'); | 8 models = Y.namespace('juju.models'); |
9 done(); | 9 done(); |
10 }); | 10 }); |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 | 636 |
637 // adjust the dates on there manually because the tests will be run on | 637 // adjust the dates on there manually because the tests will be run on |
638 // different days throwing things off. | 638 // different days throwing things off. |
639 Y.each([0, 1, 2], function(index) { | 639 Y.each([0, 1, 2], function(index) { |
640 commits[index].date = new Date(); | 640 commits[index].date = new Date(); |
641 commits[index].date.setDate(today.getDate() - (1 + index)); | 641 commits[index].date.setDate(today.getDate() - (1 + index)); |
642 }); | 642 }); |
643 instance.get('recent_commit_count').should.equal(3); | 643 instance.get('recent_commit_count').should.equal(3); |
644 }); | 644 }); |
645 }); | 645 }); |
| 646 |
| 647 |
| 648 describe('service models', function() { |
| 649 var models, list, django, rails, mysql; |
| 650 |
| 651 before(function(done) { |
| 652 YUI(GlobalConfig).use(['juju-models'], function(Y) { |
| 653 models = Y.namespace('juju.models'); |
| 654 done(); |
| 655 }); |
| 656 }); |
| 657 |
| 658 beforeEach(function() { |
| 659 django = new models.Service({id: 'django'}); |
| 660 rails = new models.Service({id: 'rails', life: 'dying'}); |
| 661 mysql = new models.Service({id: 'mysql', life: 'dead'}); |
| 662 list = new models.ServiceList({items: [rails, django, mysql]}); |
| 663 }); |
| 664 |
| 665 it('instances identify if they are alive', function() { |
| 666 // This test also verifies that the default state is "alive". |
| 667 assert.isTrue(django.isAlive()); |
| 668 }); |
| 669 |
| 670 it('instances identify if they are not alive (dying or dead)', function() { |
| 671 assert.isFalse(rails.isAlive()); |
| 672 assert.isFalse(mysql.isAlive()); |
| 673 }); |
| 674 |
| 675 it('can be filtered so that it returns only alive models', function() { |
| 676 var filtered = list.alive(); |
| 677 assert.strictEqual(1, filtered.size()); |
| 678 assert.deepEqual([django], filtered.toArray()); |
| 679 }); |
| 680 |
| 681 }); |
OLD | NEW |