Implement spies for get/set functions on accessor properties

This commit is contained in:
Sukharev Maxim
2015-12-30 13:01:19 +07:00
committed by Joe Cellucci
parent 8624a52ee0
commit 56191cfb2e
4 changed files with 258 additions and 0 deletions
+19
View File
@@ -25,4 +25,23 @@ describe("jasmineUnderTest.util", function() {
expect(jasmineUnderTest.util.isUndefined(undefined)).toBe(false);
});
});
describe("getPropertyDescriptor", function() {
it("get property descriptor from object", function() {
var obj = {prop: 1},
actual = jasmineUnderTest.util.getPropertyDescriptor(obj, 'prop'),
expected = Object.getOwnPropertyDescriptor(obj, 'prop');
expect(actual).toEqual(expected);
});
it("get property descriptor from object property", function() {
var proto = {prop: 1},
obj = Object.create(proto),
actual = jasmineUnderTest.util.getPropertyDescriptor(proto, 'prop'),
expected = Object.getOwnPropertyDescriptor(proto, 'prop');
expect(actual).toEqual(expected);
});
});
});