From 8ef50ca7665ca97df01567719abe616285237e82 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 5 Oct 2023 04:09:53 +0000 Subject: [PATCH] Auto-generated commit --- .github/.keepalive | 1 - package.json | 18 ++++---- test/dist/test.js | 109 ++------------------------------------------- 3 files changed, 13 insertions(+), 115 deletions(-) delete mode 100644 .github/.keepalive diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index f42f7cd..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-10-01T01:58:05.441Z diff --git a/package.json b/package.json index 6118070..9d5afa4 100644 --- a/package.json +++ b/package.json @@ -40,19 +40,19 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { - "@stdlib/assert-is-int8array": "^0.1.0", - "@stdlib/cli-ctor": "^0.1.0", - "@stdlib/constants-int8-max": "^0.1.0", - "@stdlib/constants-int8-min": "^0.1.0", - "@stdlib/fs-read-file": "^0.1.0" + "@stdlib/assert-is-int8array": "^0.1.1", + "@stdlib/cli-ctor": "^0.1.1", + "@stdlib/constants-int8-max": "^0.1.1", + "@stdlib/constants-int8-min": "^0.1.1", + "@stdlib/fs-read-file": "^0.1.1" }, "devDependencies": { "@stdlib/array-int8": "^0.1.0", - "@stdlib/assert-is-boolean": "^0.1.0", - "@stdlib/assert-is-browser": "^0.1.0", - "@stdlib/assert-is-windows": "^0.1.0", + "@stdlib/assert-is-boolean": "^0.1.1", + "@stdlib/assert-is-browser": "^0.1.1", + "@stdlib/assert-is-windows": "^0.1.1", "@stdlib/bench": "^0.1.0", - "@stdlib/process-exec-path": "^0.1.0", + "@stdlib/process-exec-path": "^0.1.1", "proxyquire": "^2.0.0", "tape": "git+https://github.com/kgryte/tape.git#fix/globby", "istanbul": "^0.4.1", diff --git a/test/dist/test.js b/test/dist/test.js index 17054e8..a8a9c60 100644 --- a/test/dist/test.js +++ b/test/dist/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* Copyright (c) 2023 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,114 +21,13 @@ // MODULES // var tape = require( 'tape' ); -var proxyquire = require( 'proxyquire' ); -var Int8Array = require( '@stdlib/array-int8' ); -var detect = require( './../../dist' ); - - -// VARIABLES // - -var hasInt8Array = ( typeof Int8Array === 'function' ); +var main = require( './../../dist' ); // TESTS // -tape( 'main export is a function', function test( t ) { +tape( 'main export is defined', function test( t ) { t.ok( true, __filename ); - t.strictEqual( typeof detect, 'function', 'main export is a function' ); + t.strictEqual( main !== void 0, true, 'main export is defined' ); t.end(); }); - -tape( 'feature detection result is a boolean', function test( t ) { - t.strictEqual( typeof detect(), 'boolean', 'detection result is a boolean' ); - t.end(); -}); - -tape( 'if `Int8Array` is supported, detection result is `true`', function test( t ) { - var mocked; - if ( hasInt8Array ) { - t.strictEqual( detect(), true, 'detection result is `true`' ); - } else { - t.strictEqual( detect(), false, 'detection result is `false`' ); - } - mocked = proxyquire( './../dist/main.js', { - './int8array.js': Mock, - '@stdlib/assert-is-int8array': isArray - }); - t.strictEqual( mocked(), true, 'detection result is `true` (mocked)' ); - - t.end(); - - function isArray() { - return true; - } - - function Mock() { - return [ - 1, - 3, - -3, - -128 - ]; - } -}); - -tape( 'if `Int8Array` is not supported, detection result is `false`', function test( t ) { - var mocked; - if ( hasInt8Array ) { - t.strictEqual( detect(), true, 'detection result is `true`' ); - } else { - t.strictEqual( detect(), false, 'detection result is `false`' ); - } - mocked = proxyquire( './../dist/main.js', { - './int8array.js': {} - }); - t.strictEqual( mocked(), false, 'detection result is `false`' ); - - mocked = proxyquire( './../dist/main.js', { - './int8array.js': Mock1 - }); - t.strictEqual( mocked(), false, 'detection result is `false`' ); - - mocked = proxyquire( './../dist/main.js', { - './int8array.js': Mock2, - '@stdlib/assert-is-int8array': isArray - }); - t.strictEqual( mocked(), false, 'detection result is `false`' ); - - mocked = proxyquire( './../dist/main.js', { - './int8array.js': Mock3, - '@stdlib/assert-is-int8array': isArray - }); - t.strictEqual( mocked(), false, 'detection result is `false`' ); - - mocked = proxyquire( './../dist/main.js', { - './int8array.js': Mock4 - }); - t.strictEqual( mocked(), false, 'detection result is `false`' ); - - t.end(); - - function isArray() { - return true; - } - - function Mock1() { - // Not a typed array: - return []; - } - - function Mock2() { - // Does not truncate... - return [ 1, 3.14, -3.14, -128 ]; - } - - function Mock3() { - // Does not wrap around... - return [ 1, 3, -3, 128 ]; - } - - function Mock4() { - throw new Error( 'beep' ); - } -});