Have properties added by createSpyObj() be enumerable.

This commit is contained in:
DCtheTall
2020-10-02 13:49:34 -04:00
parent d27bb8fa96
commit d5d5d1965f
2 changed files with 6 additions and 4 deletions

View File

@@ -183,14 +183,13 @@ describe('Spies', function() {
var spyObj = env.createSpyObj('base', ['method1'], ['prop1']);
expect(spyObj).toEqual({
method1: jasmine.any(Function)
method1: jasmine.any(Function),
prop1: undefined
});
var descriptor = Object.getOwnPropertyDescriptor(spyObj, 'prop1');
expect(descriptor.get.and.identity).toEqual('base.prop1.get');
expect(descriptor.set.and.identity).toEqual('base.prop1.set');
expect(spyObj.prop1).toBeUndefined();
});
it('creates an object with property names and return values if second object is passed', function() {
@@ -200,7 +199,9 @@ describe('Spies', function() {
});
expect(spyObj).toEqual({
method1: jasmine.any(Function)
method1: jasmine.any(Function),
prop1: 'foo',
prop2: 37
});
expect(spyObj.prop1).toEqual('foo');