Skip to content

Commit 8f08f8b

Browse files
committed
Auto-generated commit
1 parent 6f07c42 commit 8f08f8b

File tree

3 files changed

+13
-249
lines changed

3 files changed

+13
-249
lines changed

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@
3737
"url": "https://github.com/stdlib-js/stdlib/issues"
3838
},
3939
"dependencies": {
40-
"@stdlib/assert-has-own-property": "^0.1.0",
41-
"@stdlib/assert-is-writable-property": "^0.1.0",
42-
"@stdlib/object-ctor": "^0.1.0",
43-
"@stdlib/utils-get-prototype-of": "^0.1.0",
40+
"@stdlib/assert-has-own-property": "^0.1.1",
41+
"@stdlib/assert-is-writable-property": "^0.1.1",
42+
"@stdlib/object-ctor": "^0.1.1",
43+
"@stdlib/utils-get-prototype-of": "^0.1.1",
4444
"@stdlib/utils-property-names": "^0.1.0",
45-
"@stdlib/utils-property-symbols": "^0.1.0"
45+
"@stdlib/utils-property-symbols": "^0.1.1"
4646
},
4747
"devDependencies": {
48-
"@stdlib/assert-has-symbol-support": "^0.1.0",
49-
"@stdlib/assert-is-array": "^0.1.0",
48+
"@stdlib/assert-has-symbol-support": "^0.1.1",
49+
"@stdlib/assert-is-array": "^0.1.1",
5050
"@stdlib/bench": "^0.1.0",
5151
"@stdlib/random-base-randu": "^0.1.0",
52-
"@stdlib/symbol-ctor": "^0.1.0",
53-
"@stdlib/utils-define-property": "^0.1.0",
52+
"@stdlib/symbol-ctor": "^0.1.1",
53+
"@stdlib/utils-define-property": "^0.1.1",
5454
"@stdlib/utils-index-of": "^0.1.0",
5555
"proxyquire": "^2.0.0",
5656
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",

test/dist/test.js

Lines changed: 4 additions & 239 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2018 The Stdlib Authors.
4+
* Copyright (c) 2023 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -21,248 +21,13 @@
2121
// MODULES //
2222

2323
var tape = require( 'tape' );
24-
var proxyquire = require( 'proxyquire' );
25-
var indexOf = require( '@stdlib/utils-index-of' );
26-
var defineProperty = require( '@stdlib/utils-define-property' );
27-
var hasSymbolSupport = require( '@stdlib/assert-has-symbol-support' );
28-
var Symbol = require( '@stdlib/symbol-ctor' );
29-
var writablePropertiesIn = require( './../../dist' );
30-
31-
32-
// VARIABLES //
33-
34-
var hasSymbols = hasSymbolSupport();
24+
var main = require( './../../dist' );
3525

3626

3727
// TESTS //
3828

39-
tape( 'main export is a function', function test( t ) {
29+
tape( 'main export is defined', function test( t ) {
4030
t.ok( true, __filename );
41-
t.strictEqual( typeof writablePropertiesIn, 'function', 'main export is a function' );
42-
t.end();
43-
});
44-
45-
tape( 'the function returns an array of an object\'s own and inherited writable property names and symbols', function test( t ) {
46-
var expected;
47-
var symbols;
48-
var actual;
49-
var obj;
50-
var idx;
51-
var i;
52-
53-
if ( hasSymbols ) {
54-
symbols = [
55-
Symbol( 'a' ),
56-
Symbol( 'b' ),
57-
Symbol( 'c' )
58-
];
59-
} else {
60-
symbols = [];
61-
}
62-
63-
function Foo() {
64-
defineProperty( this, 'a', {
65-
'configurable': true,
66-
'enumerable': false,
67-
'writable': true,
68-
'value': 'a'
69-
});
70-
defineProperty( this, 'b', {
71-
'configurable': true,
72-
'enumerable': true,
73-
'writable': false,
74-
'value': 'b'
75-
});
76-
if ( hasSymbols ) {
77-
defineProperty( this, symbols[ 0 ], {
78-
'configurable': true,
79-
'enumerable': false,
80-
'writable': true,
81-
'value': 'a'
82-
});
83-
defineProperty( this, symbols[ 1 ], {
84-
'configurable': true,
85-
'enumerable': true,
86-
'writable': false,
87-
'value': 'b'
88-
});
89-
}
90-
return this;
91-
}
92-
93-
defineProperty( Foo.prototype, 'b', {
94-
'configurable': true,
95-
'enumerable': false,
96-
'writable': false,
97-
'value': 'c'
98-
});
99-
defineProperty( Foo.prototype, 'c', {
100-
'configurable': true,
101-
'enumerable': false,
102-
'writable': true,
103-
'value': 'c'
104-
});
105-
defineProperty( Foo.prototype, 'd', {
106-
'configurable': true,
107-
'enumerable': true,
108-
'writable': false,
109-
'value': 'd'
110-
});
111-
if ( hasSymbols ) {
112-
defineProperty( Foo.prototype, symbols[ 1 ], {
113-
'configurable': true,
114-
'enumerable': false,
115-
'writable': false,
116-
'value': 'b'
117-
});
118-
defineProperty( Foo.prototype, symbols[ 2 ], {
119-
'configurable': true,
120-
'enumerable': true,
121-
'writable': false,
122-
'value': 'c'
123-
});
124-
}
125-
126-
obj = new Foo();
127-
128-
expected = [ 'a', 'c' ];
129-
if ( hasSymbols ) {
130-
expected.push( symbols[ 0 ] );
131-
}
132-
actual = writablePropertiesIn( obj );
133-
134-
t.strictEqual( actual.length >= expected.length, true, 'has expected length' );
135-
for ( i = 0; i < expected.length; i++ ) {
136-
idx = indexOf( actual, expected[ i ] );
137-
t.strictEqual( idx !== -1, true, 'contains property: '+expected[i].toString() );
138-
}
139-
idx = indexOf( actual, 'b' );
140-
t.strictEqual( idx, -1, 'does not contain property' );
141-
if ( hasSymbols ) {
142-
idx = indexOf( actual, symbols[ 1 ] );
143-
t.strictEqual( idx, -1, 'does not contain property' );
144-
}
145-
t.end();
146-
});
147-
148-
tape( 'the function returns an array of an object\'s own and inherited writable property names and symbols (mock)', function test( t ) {
149-
var writablePropertiesIn;
150-
var expected;
151-
var symbols;
152-
var actual;
153-
var obj;
154-
var idx;
155-
var i;
156-
157-
writablePropertiesIn = proxyquire( './../dist/main.js', {
158-
'@stdlib/utils-property-symbols': propertySymbols
159-
});
160-
161-
symbols = [ '__a__', '__b__', '__c__' ];
162-
163-
function Foo() {
164-
defineProperty( this, 'a', {
165-
'configurable': true,
166-
'enumerable': false,
167-
'writable': true,
168-
'value': 'a'
169-
});
170-
defineProperty( this, 'b', {
171-
'configurable': true,
172-
'enumerable': true,
173-
'writable': false,
174-
'value': 'b'
175-
});
176-
defineProperty( this, symbols[ 0 ], {
177-
'configurable': true,
178-
'enumerable': false,
179-
'writable': true,
180-
'value': 'a'
181-
});
182-
defineProperty( this, symbols[ 1 ], {
183-
'configurable': true,
184-
'enumerable': true,
185-
'writable': false,
186-
'value': 'b'
187-
});
188-
return this;
189-
}
190-
191-
defineProperty( Foo.prototype, 'b', {
192-
'configurable': true,
193-
'enumerable': true,
194-
'writable': false,
195-
'value': 'c'
196-
});
197-
defineProperty( Foo.prototype, 'c', {
198-
'configurable': true,
199-
'enumerable': false,
200-
'writable': true,
201-
'value': 'c'
202-
});
203-
defineProperty( Foo.prototype, 'd', {
204-
'configurable': true,
205-
'enumerable': false,
206-
'writable': false,
207-
'value': 'd'
208-
});
209-
defineProperty( Foo.prototype, symbols[ 1 ], {
210-
'configurable': true,
211-
'enumerable': false,
212-
'writable': false,
213-
'value': 'b'
214-
});
215-
defineProperty( Foo.prototype, symbols[ 2 ], {
216-
'configurable': true,
217-
'enumerable': true,
218-
'writable': false,
219-
'value': 'c'
220-
});
221-
222-
obj = new Foo();
223-
224-
expected = [ 'a', 'c', symbols[ 0 ] ];
225-
actual = writablePropertiesIn( obj );
226-
227-
t.strictEqual( actual.length >= expected.length, true, 'has expected length' );
228-
for ( i = 0; i < expected.length; i++ ) {
229-
idx = indexOf( actual, expected[ i ] );
230-
t.strictEqual( idx !== -1, true, 'contains property: '+expected[i].toString() );
231-
}
232-
idx = indexOf( actual, 'b' );
233-
t.strictEqual( idx, -1, 'does not contain property' );
234-
235-
idx = indexOf( actual, symbols[ 1 ] );
236-
t.strictEqual( idx, -1, 'does not contain property' );
237-
238-
t.end();
239-
240-
function propertySymbols( value ) {
241-
if ( value === obj ) {
242-
return symbols.slice( 0, 2 );
243-
}
244-
if ( value === Foo.prototype ) {
245-
return symbols.slice( 1 );
246-
}
247-
return [];
248-
}
249-
});
250-
251-
tape( 'the function returns an empty array if provided `null` or `undefined`', function test( t ) {
252-
var expected;
253-
var actual;
254-
var values;
255-
var i;
256-
257-
values = [
258-
void 0,
259-
null
260-
];
261-
expected = [];
262-
263-
for ( i = 0; i < values.length; i++ ) {
264-
actual = writablePropertiesIn( values[ i ] );
265-
t.deepEqual( actual, expected, 'returns expected value when provided '+values[ i ] );
266-
}
31+
t.strictEqual( main !== void 0, true, 'main export is defined' );
26732
t.end();
26833
});

0 commit comments

Comments
 (0)