Skip to content

Commit c5d0065

Browse files
committed
Auto-generated commit
1 parent 86973cf commit c5d0065

File tree

3 files changed

+11
-174
lines changed

3 files changed

+11
-174
lines changed

.github/.keepalive

-1
This file was deleted.

package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@
4242
"devDependencies": {
4343
"@stdlib/array-float64": "^0.1.0",
4444
"@stdlib/array-uint8": "^0.1.0",
45-
"@stdlib/assert-has-own-property": "^0.1.0",
46-
"@stdlib/assert-has-property": "^0.1.0",
47-
"@stdlib/assert-instance-of": "^0.1.0",
48-
"@stdlib/assert-is-arraybuffer": "^0.1.0",
49-
"@stdlib/assert-is-function": "^0.1.0",
45+
"@stdlib/assert-has-own-property": "^0.1.1",
46+
"@stdlib/assert-has-property": "^0.1.1",
47+
"@stdlib/assert-instance-of": "^0.1.1",
48+
"@stdlib/assert-is-arraybuffer": "^0.1.1",
49+
"@stdlib/assert-is-function": "^0.1.1",
5050
"@stdlib/bench": "^0.1.0",
51-
"@stdlib/constants-float64-max-safe-integer": "^0.1.0",
51+
"@stdlib/constants-float64-max-safe-integer": "^0.1.1",
5252
"@stdlib/math-base-special-pow": "^0.1.0",
5353
"@stdlib/number-uint8-base-to-binary-string": "^0.1.0",
54-
"@stdlib/process-node-version": "^0.1.0",
54+
"@stdlib/process-node-version": "^0.1.1",
5555
"@stdlib/random-base-randu": "^0.1.0",
5656
"proxyquire": "^2.0.0",
5757
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",

test/dist/test.js

+4-166
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,175 +21,13 @@
2121
// MODULES //
2222

2323
var tape = require( 'tape' );
24-
var proxyquire = require( 'proxyquire' );
25-
var hasArrayBufferSupport = require( '@stdlib/assert-has-arraybuffer-support' );
26-
var isFunction = require( '@stdlib/assert-is-function' );
27-
var instanceOf = require( '@stdlib/assert-instance-of' );
28-
var Float64Array = require( '@stdlib/array-float64' );
29-
var MAX_SAFE_INTEGER = require( '@stdlib/constants-float64-max-safe-integer' );
30-
var hasOwnProp = require( '@stdlib/assert-has-own-property' );
31-
var hasProp = require( '@stdlib/assert-has-property' );
32-
var NODE_VERSION = require( '@stdlib/process-node-version' );
33-
var polyfill = require( './../../dist/polyfill.js' );
34-
var Ctor = require( './../../dist' );
35-
36-
37-
// VARIABLES //
38-
39-
var FLG = hasArrayBufferSupport();
40-
var opts = {
41-
'skip': ( NODE_VERSION && NODE_VERSION.slice( 0, 4 ) === '0.10' ) // FIXME: remove once polyfill is written
42-
};
24+
var main = require( './../../dist' );
4325

4426

4527
// TESTS //
4628

47-
tape( 'main export is a function', function test( t ) {
29+
tape( 'main export is defined', function test( t ) {
4830
t.ok( true, __filename );
49-
t.strictEqual( typeof Ctor, 'function', 'main export is a function' );
50-
t.end();
51-
});
52-
53-
tape( 'if an environment supports `ArrayBuffer`, the export is an alias for `ArrayBuffer`', function test( t ) {
54-
var Foo = proxyquire( './../dist', {
55-
'@stdlib/assert-has-arraybuffer-support': isTrue,
56-
'./main.js': Mock
57-
});
58-
t.strictEqual( Foo, Mock, 'returns builtin' );
59-
60-
if ( FLG ) {
61-
t.strictEqual( Ctor, ArrayBuffer, 'is alias' ); // eslint-disable-line stdlib/require-globals
62-
}
63-
64-
t.end();
65-
66-
function Mock() {
67-
return this;
68-
}
69-
70-
function isTrue() {
71-
return true;
72-
}
73-
});
74-
75-
tape( 'if an environment does not support `ArrayBuffer`, the export is a polyfill', function test( t ) {
76-
var Foo = proxyquire( './../dist', {
77-
'@stdlib/assert-has-arraybuffer-support': isFalse
78-
});
79-
80-
t.strictEqual( Foo, polyfill, 'returns polyfill' );
81-
t.end();
82-
83-
function isFalse() {
84-
return false;
85-
}
86-
});
87-
88-
tape( 'the main export is a constructor', opts, function test( t ) {
89-
var buf = new Ctor( 10 );
90-
t.strictEqual( instanceOf( buf, Ctor ), true, 'returns an instance' );
91-
t.end();
92-
});
93-
94-
tape( 'the constructor has a static method for testing whether a value is a buffer view', opts, function test( t ) {
95-
var arr;
96-
97-
t.strictEqual( isFunction( Ctor.isView ), true, 'has method' );
98-
99-
arr = new Float64Array( 10 );
100-
t.strictEqual( Ctor.isView( arr ), true, 'returns expected value' );
101-
t.strictEqual( Ctor.isView( [] ), false, 'returns expected value' );
102-
103-
t.end();
104-
});
105-
106-
tape( 'the constructor length is equal to `1`', opts, function test( t ) {
107-
t.strictEqual( Ctor.length, 1, 'returns expected value' );
108-
t.end();
109-
});
110-
111-
tape( 'the constructor throws an error if provided a value exceeding `2^53-1`', opts, function test( t ) {
112-
t.throws( badValue, RangeError, 'throws an error' );
113-
t.end();
114-
115-
function badValue() {
116-
return new Ctor( MAX_SAFE_INTEGER+1 );
117-
}
118-
});
119-
120-
tape( 'the constructor returns an `ArrayBuffer` instance having a `byteLength` property, which returns the number of bytes in an `ArrayBuffer`', opts, function test( t ) {
121-
var buf;
122-
123-
t.strictEqual( hasOwnProp( Ctor.prototype, 'byteLength' ), true, 'has prototype property' );
124-
125-
buf = new Ctor( 10 );
126-
t.strictEqual( hasOwnProp( buf, 'byteLength' ), false, 'does not have own property' );
127-
t.strictEqual( hasProp( buf, 'byteLength' ), true, 'has property' );
128-
t.strictEqual( buf.byteLength, 10, 'returns expected value' );
129-
130-
t.end();
131-
});
132-
133-
tape( 'the constructor returns an `ArrayBuffer` instance having a `slice` method, which copies the bytes of an `ArrayBuffer` to a new `ArrayBuffer`', opts, function test( t ) {
134-
var b1;
135-
var b2;
136-
137-
t.strictEqual( hasOwnProp( Ctor.prototype, 'slice' ), true, 'has prototype property' );
138-
t.strictEqual( isFunction( Ctor.prototype.slice ), true, 'has method' );
139-
140-
b1 = new Ctor( 10 );
141-
t.strictEqual( hasOwnProp( b1, 'slice' ), false, 'does not have own property' );
142-
t.strictEqual( hasProp( b1, 'slice' ), true, 'has property' );
143-
144-
b2 = b1.slice();
145-
t.strictEqual( instanceOf( b2, Ctor ), true, 'returns an instance' );
146-
t.notEqual( b2, b1, 'returns a new reference' );
147-
t.strictEqual( b2.byteLength, b1.byteLength, 'has same number of bytes' );
148-
149-
b2 = b1.slice( 2 );
150-
t.strictEqual( instanceOf( b2, Ctor ), true, 'returns an instance' );
151-
t.notEqual( b2, b1, 'returns a new reference' );
152-
t.strictEqual( b2.byteLength, 8, 'has expected number of bytes' );
153-
154-
b2 = b1.slice( b1.byteLength + 10 );
155-
t.strictEqual( instanceOf( b2, Ctor ), true, 'returns an instance' );
156-
t.notEqual( b2, b1, 'returns a new reference' );
157-
t.strictEqual( b2.byteLength, 0, 'has expected number of bytes' );
158-
159-
b2 = b1.slice( -2 );
160-
t.strictEqual( instanceOf( b2, Ctor ), true, 'returns an instance' );
161-
t.notEqual( b2, b1, 'returns a new reference' );
162-
t.strictEqual( b2.byteLength, 2, 'has expected number of bytes' );
163-
164-
b2 = b1.slice( -100 );
165-
t.strictEqual( instanceOf( b2, Ctor ), true, 'returns an instance' );
166-
t.notEqual( b2, b1, 'returns a new reference' );
167-
t.strictEqual( b2.byteLength, 10, 'has expected number of bytes' );
168-
169-
b2 = b1.slice( 0, 6 );
170-
t.strictEqual( instanceOf( b2, Ctor ), true, 'returns an instance' );
171-
t.notEqual( b2, b1, 'returns a new reference' );
172-
t.strictEqual( b2.byteLength, 6, 'has expected number of bytes' );
173-
174-
b2 = b1.slice( 2, 6 );
175-
t.strictEqual( instanceOf( b2, Ctor ), true, 'returns an instance' );
176-
t.notEqual( b2, b1, 'returns a new reference' );
177-
t.strictEqual( b2.byteLength, 4, 'has expected number of bytes' );
178-
179-
b2 = b1.slice( 0, -2 );
180-
t.strictEqual( instanceOf( b2, Ctor ), true, 'returns an instance' );
181-
t.notEqual( b2, b1, 'returns a new reference' );
182-
t.strictEqual( b2.byteLength, 8, 'has expected number of bytes' );
183-
184-
b2 = b1.slice( 0, -100 );
185-
t.strictEqual( instanceOf( b2, Ctor ), true, 'returns an instance' );
186-
t.notEqual( b2, b1, 'returns a new reference' );
187-
t.strictEqual( b2.byteLength, 0, 'has expected number of bytes' );
188-
189-
b2 = b1.slice( -4, -2 );
190-
t.strictEqual( instanceOf( b2, Ctor ), true, 'returns an instance' );
191-
t.notEqual( b2, b1, 'returns a new reference' );
192-
t.strictEqual( b2.byteLength, 2, 'has expected number of bytes' );
193-
31+
t.strictEqual( main !== void 0, true, 'main export is defined' );
19432
t.end();
19533
});

0 commit comments

Comments
 (0)