main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
656 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var test = require('tape');
|
---|
| 4 | var gOPD = require('../');
|
---|
| 5 |
|
---|
| 6 | test('gOPD', function (t) {
|
---|
| 7 | t.test('supported', { skip: !gOPD }, function (st) {
|
---|
| 8 | st.equal(typeof gOPD, 'function', 'is a function');
|
---|
| 9 |
|
---|
| 10 | var obj = { x: 1 };
|
---|
| 11 | st.ok('x' in obj, 'property exists');
|
---|
| 12 |
|
---|
[79a0317] | 13 | // @ts-expect-error TS can't figure out narrowing from `skip`
|
---|
[d565449] | 14 | var desc = gOPD(obj, 'x');
|
---|
| 15 | st.deepEqual(
|
---|
| 16 | desc,
|
---|
| 17 | {
|
---|
| 18 | configurable: true,
|
---|
| 19 | enumerable: true,
|
---|
| 20 | value: 1,
|
---|
| 21 | writable: true
|
---|
| 22 | },
|
---|
| 23 | 'descriptor is as expected'
|
---|
| 24 | );
|
---|
| 25 |
|
---|
| 26 | st.end();
|
---|
| 27 | });
|
---|
| 28 |
|
---|
[79a0317] | 29 | t.test('not supported', { skip: !!gOPD }, function (st) {
|
---|
[d565449] | 30 | st.notOk(gOPD, 'is falsy');
|
---|
| 31 |
|
---|
| 32 | st.end();
|
---|
| 33 | });
|
---|
| 34 |
|
---|
| 35 | t.end();
|
---|
| 36 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.