'use strict';

/* jasmine specs for controllers go here */

describe('RootCtrl', function(){
    var scope;

    beforeEach(module('swiftBrowser.controllers'));

    beforeEach(inject(function($controller) {
        scope = {};
        $controller('RootCtrl', {$scope: scope});
    }));

    it('should list containers', inject(function($httpBackend) {
        var containers = [
            {"count": 10, "bytes": 1234, "name": "foo"},
            {"count": 20, "bytes": 2345, "name": "bar"},
        ];
        $httpBackend.whenGET('/v1/AUTH_abc?format=json')
            .respond(200, containers);

        expect(scope.containers).toEqual([]);
        $httpBackend.flush();
        expect(scope.containers).toEqual(containers);
    }));

    it('should set sort order', function() {
        expect(scope.orderProp).toEqual('name');
    });

});

@@ -838,12 +838,545 @@
    %7D);%0A%0A%7D);%0A
+%0A%0Adescribe('ContainerCtrl', function()%7B%0A    var scope;%0A%0A    beforeEach(module('swiftBrowser.controllers'));%0A%0A    beforeEach(inject(function($controller) %7B%0A        var params = %7Bcontainer: 'cont'%7D;%0A        scope = %7B%7D;%0A        $controller('ContainerCtrl',%0A                    %7B$scope: scope, $routeParams: params%7D);%0A    %7D));%0A%0A    it('should set sort order', function() %7B%0A        expect(scope.orderProp).toEqual('name');%0A    %7D);%0A%0A    it('should set container', function() %7B%0A        expect(scope.container).toEqual('cont');%0A    %7D);%0A%0A%7D);%0A

Add unit test for ContainerCtrl