fixes testing due to wrong httpbackend injection
This commit is contained in:
@@ -3,7 +3,7 @@ describe('content factory tests', function () {
|
||||
|
||||
beforeEach(module('umbraco.services'));
|
||||
beforeEach(module('umbraco.resources'));
|
||||
beforeEach(module('umbraco.httpbackend'));
|
||||
beforeEach(module('umbraco.mocks'));
|
||||
|
||||
beforeEach(inject(function ($injector) {
|
||||
$rootScope = $injector.get('$rootScope');
|
||||
@@ -21,6 +21,8 @@ describe('content factory tests', function () {
|
||||
|
||||
|
||||
describe('global content factory crud', function () {
|
||||
|
||||
|
||||
it('should return a content object, given an id', function () {
|
||||
var doc;
|
||||
contentFactory.getById(1234).then(function(result){
|
||||
@@ -28,6 +30,7 @@ describe('content factory tests', function () {
|
||||
});
|
||||
|
||||
$rootScope.$digest();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(doc).toNotBe(undefined);
|
||||
expect(doc.id).toBe(1234);
|
||||
@@ -36,10 +39,15 @@ describe('content factory tests', function () {
|
||||
|
||||
it('should return a content children collection given an id', function () {
|
||||
var collection = contentFactory.getChildren(1234, undefined);
|
||||
$rootScope.$digest();
|
||||
$httpBackend.flush();
|
||||
expect(collection.resultSet.length).toBe(10);
|
||||
|
||||
collection = contentFactory.getChildren(1234,{take: 5, offset: 1, filter: ""});
|
||||
$rootScope.$digest();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(collection.resultSet.length).toBe(5);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,48 +1,46 @@
|
||||
describe('content type factory tests', function () {
|
||||
var $rootScope, $httpBackend, contentTypeResource, m;
|
||||
|
||||
beforeEach(module('ngMockE2E'));
|
||||
// beforeEach(module('ngMockE2E'));
|
||||
beforeEach(module('umbraco.resources'));
|
||||
beforeEach(module('umbraco.httpbackend'));
|
||||
beforeEach(module('umbraco.mocks'));
|
||||
|
||||
beforeEach(inject(function ($injector, contentTypeMocks) {
|
||||
$rootScope = $injector.get('$rootScope');
|
||||
$httpBackend = $injector.get('$httpBackend');
|
||||
m = contentTypeMocks;
|
||||
m.register();
|
||||
|
||||
contentTypeResource = $injector.get('contentTypeResource');
|
||||
beforeEach(inject(function ($injector) {
|
||||
$rootScope = $injector.get('$rootScope');
|
||||
$httpBackend = $injector.get('$httpBackend');
|
||||
mocks = $injector.get("contentTypeMocks");
|
||||
mocks.register();
|
||||
contentTypeResource = $injector.get('contentTypeResource');
|
||||
}));
|
||||
|
||||
|
||||
describe('global content type factory crud', function () {
|
||||
/*
|
||||
|
||||
it('should return a content type object, given an id', function () {
|
||||
|
||||
var ct1;
|
||||
contentTypeResource.getContentType(1234).then(function(result){
|
||||
ct1 = result;
|
||||
});
|
||||
|
||||
$rootScope.$digest();
|
||||
$rootScope.$digest();
|
||||
|
||||
console.log("ct1:", ct1);
|
||||
$rootScope.$digest();
|
||||
|
||||
expect(ct1).toNotBe(undefined);
|
||||
expect(ct1.id).toBe(1234);
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
it('should return a allowed content type collection given a document id', function(){
|
||||
|
||||
m.expectAllowedChildren();
|
||||
// m.expectAllowedChildren();
|
||||
|
||||
var collection;
|
||||
contentTypeResource.getAllowedTypes(1234).then(function(result){
|
||||
collection = result;
|
||||
});
|
||||
|
||||
|
||||
$rootScope.$digest();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(collection.length).toBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user