|
|
|
@ -119,7 +119,7 @@ describe('QueryService', function() { |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
describe('loadAvailableGroupedQueries', function() { |
|
|
|
|
describe('async part', function() { |
|
|
|
|
var projectIdentifier = 'test_project', |
|
|
|
|
$httpBackend, |
|
|
|
|
$rootScope, |
|
|
|
@ -145,6 +145,27 @@ describe('QueryService', function() { |
|
|
|
|
$httpBackend.when('GET', path).respond(200, groupedQueries); |
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
describe('saveQuery', function() { |
|
|
|
|
beforeEach(function() { |
|
|
|
|
$httpBackend |
|
|
|
|
.when('GET', PathHelper.apiCustomFieldsPath()) |
|
|
|
|
.respond(200, { data: {} }); |
|
|
|
|
$httpBackend |
|
|
|
|
.when('GET', PathHelper.apiGroupedQueriesPath()) |
|
|
|
|
.respond(200, { data: {} }); |
|
|
|
|
var putPath = new RegExp(PathHelper.apiQueriesPath() + '/*'); |
|
|
|
|
$httpBackend.when('PUT', putPath).respond(200, { data: { } }); |
|
|
|
|
}); |
|
|
|
|
it('should set the query pristine', function() { |
|
|
|
|
query = QueryService.initQuery(1, queryData); |
|
|
|
|
query.dirty = true; |
|
|
|
|
QueryService.saveQuery(); |
|
|
|
|
$httpBackend.flush(); |
|
|
|
|
expect(query.isDirty()).to.be.false; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
describe('loadAvailableGroupedQueries', function() { |
|
|
|
|
describe('when called for the first time', function() { |
|
|
|
|
it('triggers an http request', function() { |
|
|
|
|
$httpBackend.expectGET(path); |
|
|
|
@ -168,6 +189,7 @@ describe('QueryService', function() { |
|
|
|
|
$httpBackend.verifyNoOutstandingRequest(); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|