Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit b89a4e4

Browse files
committed
test: rename / remove duplicate unit tests
1 parent eefcdad commit b89a4e4

8 files changed

+16
-85
lines changed

test/AngularSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ describe('angular', function() {
8888
expect(dst.a).not.toBe(src.a);
8989
});
9090

91-
it("should deeply copy an object into an existing object", function() {
91+
it("should deeply copy an object into a non-existing object", function() {
9292
var src = {a:{name:"value"}};
93-
var dst = copy(src, dst);
93+
var dst = copy(src, undefined);
9494
expect(src).toEqual({a:{name:"value"}});
9595
expect(dst).toEqual(src);
9696
expect(dst).not.toBe(src);

test/ng/compileSpec.js

+6-51
Original file line numberDiff line numberDiff line change
@@ -1488,16 +1488,6 @@ describe('$compile', function() {
14881488
);
14891489

14901490

1491-
it('should not allow more then one isolate scope creation per element', inject(
1492-
function($rootScope, $compile) {
1493-
expect(function(){
1494-
$compile('<div class="iscope-a; iscope-b"></div>');
1495-
}).toThrowMinErr('$compile', 'multidir', 'Multiple directives [iscopeA, iscopeB] asking for isolated scope on: ' +
1496-
'<div class="iscope-a; iscope-b ng-isolate-scope ng-scope">');
1497-
})
1498-
);
1499-
1500-
15011491
it('should create new scope even at the root of the template', inject(
15021492
function($rootScope, $compile, log) {
15031493
element = $compile('<div scope-a></div>')($rootScope);
@@ -1824,24 +1814,6 @@ describe('$compile', function() {
18241814
});
18251815
});
18261816

1827-
it('should allow setting of attributes', function() {
1828-
module(function() {
1829-
directive({
1830-
setter: valueFn(function(scope, element, attr) {
1831-
attr.$set('name', 'abc');
1832-
attr.$set('disabled', true);
1833-
expect(attr.name).toBe('abc');
1834-
expect(attr.disabled).toBe(true);
1835-
})
1836-
});
1837-
});
1838-
inject(function($rootScope, $compile) {
1839-
element = $compile('<div setter></div>')($rootScope);
1840-
expect(element.attr('name')).toEqual('abc');
1841-
expect(element.attr('disabled')).toEqual('disabled');
1842-
});
1843-
});
1844-
18451817

18461818
it('should create new instance of attr for each template stamping', function() {
18471819
module(function($provide) {
@@ -2055,32 +2027,15 @@ describe('$compile', function() {
20552027

20562028
$rootScope.name = 'misko';
20572029
$rootScope.$apply();
2058-
expect(componentScope.ref).toBe($rootScope.name);
2059-
expect(componentScope.refAlias).toBe($rootScope.name);
2060-
2061-
$rootScope.name = {};
2062-
$rootScope.$apply();
2063-
expect(componentScope.ref).toBe($rootScope.name);
2064-
expect(componentScope.refAlias).toBe($rootScope.name);
2065-
}));
2066-
2067-
2068-
it('should update local when origin changes', inject(function() {
2069-
compile('<div><span my-component ref="name">');
2070-
expect(componentScope.ref).toBe(undefined);
2071-
expect(componentScope.refAlias).toBe(componentScope.ref);
20722030

2073-
componentScope.ref = 'misko';
2074-
$rootScope.$apply();
20752031
expect($rootScope.name).toBe('misko');
20762032
expect(componentScope.ref).toBe('misko');
2077-
expect($rootScope.name).toBe(componentScope.ref);
2078-
expect(componentScope.refAlias).toBe(componentScope.ref);
2033+
expect(componentScope.refAlias).toBe('misko');
20792034

2080-
componentScope.name = {};
2035+
$rootScope.name = {};
20812036
$rootScope.$apply();
2082-
expect($rootScope.name).toBe(componentScope.ref);
2083-
expect(componentScope.refAlias).toBe(componentScope.ref);
2037+
expect(componentScope.ref).toBe($rootScope.name);
2038+
expect(componentScope.refAlias).toBe($rootScope.name);
20842039
}));
20852040

20862041

@@ -3379,7 +3334,7 @@ describe('$compile', function() {
33793334
}));
33803335

33813336

3382-
it('should group on nested groups', inject(function($compile, $rootScope) {
3337+
it('should group on nested groups of same directive', inject(function($compile, $rootScope) {
33833338
$rootScope.show = false;
33843339
element = $compile(
33853340
'<div></div>' +
@@ -3427,7 +3382,7 @@ describe('$compile', function() {
34273382
});
34283383

34293384

3430-
it('should throw error if unterminated', function () {
3385+
it('should throw error if unterminated (containing termination as a child)', function () {
34313386
module(function($compileProvider) {
34323387
$compileProvider.directive('foo', function() {
34333388
return {

test/ng/httpBackendSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ describe('$httpBackend', function() {
376376
});
377377

378378

379-
it('should convert 0 to 200 if content - relative url', function() {
379+
it('should convert 0 to 404 if no content - relative url', function() {
380380
$backend = createHttpBackend($browser, MockXhr, null, null, null, 'file');
381381

382382
$backend('GET', '/whatever/index.html', null, callback);

test/ng/parseSpec.js

+1-12
Original file line numberDiff line numberDiff line change
@@ -717,17 +717,6 @@ describe('parser', function() {
717717
});
718718

719719

720-
it('should call the function once when it is not part of the context', function() {
721-
var count = 0;
722-
scope.fn = function() {
723-
count++;
724-
return function() { return 'lucas'; };
725-
};
726-
expect(scope.$eval('fn()()')).toBe('lucas');
727-
expect(count).toBe(1);
728-
});
729-
730-
731720
it('should call the function once when it is part of the context on assignments', function() {
732721
var count = 0;
733722
var element = {};
@@ -766,7 +755,7 @@ describe('parser', function() {
766755
});
767756

768757

769-
it('should call the function once when it is part of the context on array lookup function', function() {
758+
it('should call the function once when it is part of the context on property lookup function', function() {
770759
var count = 0;
771760
var element = {name: {anotherFn: function() { return 'lucas';} } };
772761
scope.fn = function() {

test/ng/qSpec.js

-9
Original file line numberDiff line numberDiff line change
@@ -1467,15 +1467,6 @@ describe('q', function() {
14671467
});
14681468

14691469

1470-
it('should still reject the promise, when exception is thrown in success handler, even if exceptionHandler rethrows', function() {
1471-
deferred.promise.then(function() { throw 'reject'; }).then(null, errorSpy);
1472-
deferred.resolve('resolve');
1473-
mockNextTick.flush();
1474-
expect(exceptionExceptionSpy).toHaveBeenCalled();
1475-
expect(errorSpy).toHaveBeenCalled();
1476-
});
1477-
1478-
14791470
it('should still reject the promise, when exception is thrown in success handler, even if exceptionHandler rethrows', function() {
14801471
deferred.promise.then(null, function() { throw 'reject again'; }).then(null, errorSpy);
14811472
deferred.reject('reject');

test/ng/sceSpecs.js

-4
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,6 @@ describe('SCE', function() {
139139
expect($sce.trustAsHtml("")).toBe("");
140140
}));
141141

142-
it('should unwrap null into null', inject(function($sce) {
143-
expect($sce.getTrusted($sce.HTML, null)).toBe(null);
144-
}));
145-
146142
it('should unwrap "" into ""', inject(function($sce) {
147143
expect($sce.getTrusted($sce.HTML, "")).toBe("");
148144
}));

test/ngMock/angular-mocksSpec.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ describe('ngMock', function() {
168168
$log.reset();
169169
}));
170170

171-
it("should skip debugging output if disabled", inject(function($log) {
171+
it("should skip debugging output if disabled (" + debugEnabled + ")", inject(function($log) {
172172
$log.log('fake log');
173173
$log.info('fake log');
174174
$log.warn('fake log');
@@ -197,19 +197,19 @@ describe('ngMock', function() {
197197
$log.reset();
198198
}));
199199

200-
it('should provide the debug method', function() {
200+
it('should provide the log method', function() {
201201
expect(function() { $log.log(''); }).not.toThrow();
202202
});
203203

204-
it('should provide the debug method', function() {
204+
it('should provide the info method', function() {
205205
expect(function() { $log.info(''); }).not.toThrow();
206206
});
207207

208-
it('should provide the debug method', function() {
208+
it('should provide the warn method', function() {
209209
expect(function() { $log.warn(''); }).not.toThrow();
210210
});
211211

212-
it('should provide the debug method', function() {
212+
it('should provide the error method', function() {
213213
expect(function() { $log.error(''); }).not.toThrow();
214214
});
215215

test/ngResource/resourceSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ describe("resource", function() {
797797
});
798798

799799

800-
it('should call the error callback if provided on non 2xx response', function() {
800+
it('should call the error callback if provided on non 2xx response (without data)', function() {
801801
$httpBackend.expect('GET', '/CreditCard').respond(ERROR_CODE, ERROR_RESPONSE);
802802

803803
CreditCard.get(callback, errorCB);

0 commit comments

Comments
 (0)