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

Commit c2fb4b6

Browse files
gkalpakIgorMinar
authored andcommitted
test($resource): enhance test-case to verify correct behaviour
Previously, the test-case verified that calling `toJson()`, would remove the `$promise` and `$resolved`, but not that other `$`-prefixed properties would not be removed. Closes #9628
1 parent 8b2f1a4 commit c2fb4b6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/ngResource/resourceSpec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,13 +658,15 @@ describe("resource", function() {
658658
var cc = CreditCard.get({id: 123});
659659
$httpBackend.flush();
660660

661+
cc.$myProp = 'still here';
662+
661663
expect(cc.$promise).toBeDefined();
662664
expect(cc.$resolved).toBe(true);
663665

664666
var json = JSON.parse(angular.toJson(cc));
665667
expect(json.$promise).not.toBeDefined();
666668
expect(json.$resolved).not.toBeDefined();
667-
expect(json).toEqual({id: 123, number: '9876'});
669+
expect(json).toEqual({id: 123, number: '9876', $myProp: 'still here'});
668670
});
669671

670672
describe('promise api', function() {

0 commit comments

Comments
 (0)