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

Commit f3d0ccd

Browse files
committed
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.
1 parent 6502ab0 commit f3d0ccd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/ngResource/resourceSpec.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,13 +658,17 @@ 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);
665+
expect(cc.$myProp).toBe('still here');
663666

664667
var json = JSON.parse(angular.toJson(cc));
665668
expect(json.$promise).not.toBeDefined();
666669
expect(json.$resolved).not.toBeDefined();
667-
expect(json).toEqual({id: 123, number: '9876'});
670+
expect(cc.$myProp).toBe('still here');
671+
expect(json).toEqual({id: 123, number: '9876', $myProp: 'still here'});
668672
});
669673

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

0 commit comments

Comments
 (0)