describe('28.io Angularjs Queries', function () {

    it('Query Listing', function () {
        var queries = {
            "public" : [ {
                "href" : "/v1/_queries/public/archives/by-generator.jq", 
                "lastModified" : "2014-02-15T15:17:50Z", 
                "preCompiled" : false
            }, {
                "href" : "/v1/_queries/public/archives/entities.jq", 
                "lastModified" : "2014-02-15T15:17:50Z", 
                "preCompiled" : false
            }, {
                "href" : "/v1/_queries/public/archives/entity-for-archive.jq", 
                "lastModified" : "2014-02-15T15:17:50Z", 
                "preCompiled" : false
            }, {
                "href" : "/v1/_queries/public/archives/for-entities.jq", 
                "lastModified" : "2014-02-15T15:17:50Z", 
                "preCompiled" : false
            } ], 
            "private" : [{
                "href" : "/v1/_queries/public/archives/for-entities.jq", 
                "lastModified" : "2014-02-15T15:17:50Z", 
                "preCompiled" : false
            }]
        }; 
        
        var projectToken = "WGkwS3E1UEljbDVPdVZVb0QxWGFGZERZdk0wPToyMDE0LTAyLTE2VDAzOjE4OjAwLjYyMzYyN1o=";
        $httpBackend.whenGET("http://test.28.io/v1/_queries/?token=" + projectToken)
        .respond(queries);
        $httpBackend.whenGET("http://test.28.io/v1/_queries/public/?token=" + projectToken)
        .respond({ public: queries.public });
        $httpBackend.whenGET("http://test.28.io/v1/_queries/private/?token=" + projectToken)
        .respond({ private: queries.private });
        $httpBackend.whenGET("http://test.28.io/v1/_queries/undefined?token=" + projectToken)
        .respond(404);
        
        var Queries = new API.Queries('http://test.28.io/v1', $cacheFactory('Queries'));
        
        Queries.listQueries(undefined, undefined)
        .then(function(queries){
            fail(JSON.stringify(queries, null, 2));
        })
        .catch(function(error){
            expect(error.message).toBeDefined();
            expect(error.message).toBe('The token parameter is required');
        });
        
        Queries.listQueries(undefined, projectToken)
        .then(function(queries){
            expect(queries).toBeDefined();
            expect(queries.public).toBeDefined();
            expect(queries.private).toBeDefined();
            expect(queries.public.length).toBeGreaterThan(0);
            expect(queries.private.length).toBeGreaterThan(0);
        })
        .catch(function(error){
            fail(JSON.stringify(error, null, 2));
        });

        Queries.listQueries('public', projectToken)
        .then(function(queries){
            expect(queries).toBeDefined();
            expect(queries.public).toBeDefined();
            expect(queries.private).toBeUndefined();
            expect(queries.public.length).toBeGreaterThan(0);
        })
        .catch(function(error){
            fail(JSON.stringify(error, null, 2));
        });

        Queries.listQueries('private', projectToken)
        .then(function(queries){
            expect(queries).toBeDefined();
            expect(queries.public).toBeUndefined();
            expect(queries.private).toBeDefined();
            expect(queries.private.length).toBeGreaterThan(0);
        })
        .catch(function(error){
            fail(JSON.stringify(error, null, 2));
        });
        
        $rootScope.$digest();
    });
});

@@ -1287,32 +1287,51 @@
 ries/?token=%22 + 
+encodeURIComponent(
 projectToken)%0A  
@@ -1319,32 +1319,33 @@
 nt(projectToken)
+)
 %0A        .respon
@@ -1422,17 +1422,16 @@
 s/public
-/
 ?token=%22
@@ -1425,32 +1425,51 @@
 ublic?token=%22 + 
+encodeURIComponent(
 projectToken)%0A  
@@ -1457,32 +1457,33 @@
 nt(projectToken)
+)
 %0A        .respon
@@ -1580,17 +1580,16 @@
 /private
-/
 ?token=%22
@@ -1583,32 +1583,51 @@
 ivate?token=%22 + 
+encodeURIComponent(
 projectToken)%0A  
@@ -1615,32 +1615,33 @@
 nt(projectToken)
+)
 %0A        .respon
@@ -1753,16 +1753,35 @@
 ken=%22 + 
+encodeURIComponent(
 projectT
@@ -1777,32 +1777,33 @@
 nt(projectToken)
+)
 %0A        .respon
@@ -2268,25 +2268,18 @@
 Queries(
-undefined
+''
 , projec

Update query tests.