(test, object, key, options)
| 8 | } |
| 9 | |
| 10 | export function testMethodProperty(test, object, key, options) { |
| 11 | |
| 12 | let desc = Object.getOwnPropertyDescriptor(object, key); |
| 13 | |
| 14 | test._(`Property ${ key.toString() } exists on the object`) |
| 15 | .equals(Boolean(desc), true); |
| 16 | |
| 17 | if (!desc) |
| 18 | return; |
| 19 | |
| 20 | if (options.get || options.set) { |
| 21 | |
| 22 | test._(`Property ${ options.get ? "has" : "does not have" } a getter`) |
| 23 | .equals(typeof desc.get, options.get ? "function" : "undefined"); |
| 24 | |
| 25 | testLength(test, desc.get, 0); |
| 26 | |
| 27 | test._(`Property ${ options.set ? "has" : "does not have" } a setter`) |
| 28 | .equals(typeof desc.set, options.set ? "function" : "undefined"); |
| 29 | |
| 30 | testLength(test, desc.set, 1); |
| 31 | |
| 32 | } else { |
| 33 | |
| 34 | test._("Property has a function value") |
| 35 | .equals(typeof desc.value, "function"); |
| 36 | |
| 37 | testLength(test, desc.value, options.length); |
| 38 | |
| 39 | test._(`Property is ${ options.writable ? "" : "non-" }writable`) |
| 40 | .equals(desc.writable, Boolean(options.writable)); |
| 41 | } |
| 42 | |
| 43 | |
| 44 | test |
| 45 | ._(`Property is ${ options.enumerable ? "" : "non-" }enumerable`) |
| 46 | .equals(desc.enumerable, Boolean(options.enumerable)) |
| 47 | ._(`Property is ${ options.configurable ? "" : "non-" }configurable`) |
| 48 | .equals(desc.configurable, Boolean(options.configurable)) |
| 49 | ; |
| 50 | |
| 51 | } |
| 52 | |
| 53 | export function hasSymbol(name) { |
| 54 |
no test coverage detected