forked from sinonjs/sinon
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add verification test for sub-issue of sinonjs#2226
This is basically the restoration of prototype props
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
const sinon = require('./lib/sinon'); | ||
const referee = require('@sinonjs/referee'); | ||
|
||
const proto = {}; | ||
const obj = {}; | ||
Object.setPrototypeOf(obj, proto); | ||
Object.defineProperty(proto, 'test', { writable: true, value: 1 }); | ||
const ownPropertyDescriptor0 = Object.getOwnPropertyDescriptor(obj, 'test'); | ||
console.log('obj', ownPropertyDescriptor0); | ||
|
||
sinon.replace(obj, 'test', 2); | ||
const ownPropertyDescriptor1 = Object.getOwnPropertyDescriptor(obj, 'test'); | ||
console.log('obj', ownPropertyDescriptor1); | ||
|
||
sinon.restore(); | ||
let ownPropertyDescriptor2 = Object.getOwnPropertyDescriptor(obj, 'test'); | ||
console.log('obj', ownPropertyDescriptor2); | ||
|
||
referee.assert.isUndefined(ownPropertyDescriptor0) | ||
referee.assert.isUndefined(ownPropertyDescriptor2) |