-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Auto-generated commit
1 parent
3848367
commit 4b30746
Showing
18 changed files
with
244 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,8 @@ jobs: | |
|
||
# Cancel existing workflow runs: | ||
- name: 'Cancel existing workflow runs' | ||
uses: styfle/[email protected] | ||
# Pin action to full length commit SHA corresponding to v0.11.0 | ||
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 | ||
with: | ||
workflow_id: >- | ||
benchmark.yml, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,11 +61,13 @@ jobs: | |
|
||
# Checkout the repository: | ||
- name: 'Checkout repository' | ||
uses: actions/checkout@v3 | ||
# Pin action to full length commit SHA corresponding to v4.1.0 | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 | ||
|
||
# Install Node.js: | ||
- name: 'Install Node.js' | ||
uses: actions/setup-node@v3 | ||
# Pin action to full length commit SHA corresponding to v3.8.1 | ||
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d | ||
with: | ||
node-version: 16 | ||
timeout-minutes: 5 | ||
|
@@ -197,7 +199,8 @@ jobs: | |
# Publish package to npm: | ||
- name: 'Publish package to npm' | ||
uses: JS-DevTools/npm-publish@v2 | ||
# Pin action to full length commit SHA corresponding to v2.2.2 | ||
uses: JS-DevTools/npm-publish@fe72237be0920f7a0cafd6a966c9b929c9466e9b | ||
with: | ||
token: ${{ secrets.NPM_TOKEN }} | ||
access: public | ||
|
@@ -209,7 +212,8 @@ jobs: | |
# Send status to Slack channel if job fails: | ||
- name: 'Send status to Slack channel in case of failure' | ||
uses: act10ns/slack@v2 | ||
# Pin action to full length commit SHA corresponding to v2.0.0 | ||
uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f | ||
with: | ||
status: ${{ job.status }} | ||
steps: ${{ toJson(steps) }} | ||
|
@@ -230,7 +234,8 @@ jobs: | |
|
||
# Cancel any running or queued workflow runs: | ||
- name: 'Cancel running or queued workflow runs' | ||
uses: styfle/[email protected] | ||
# Pin action to full length commit SHA corresponding to v0.11.0 | ||
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 | ||
with: | ||
workflow_id: >- | ||
benchmark.yml, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,13 +61,15 @@ jobs: | |
|
||
# Checkout cli branch: | ||
- name: 'Checkout cli branch' | ||
uses: actions/checkout@v3 | ||
# Pin action to full length commit SHA corresponding to v4.1.0 | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 | ||
with: | ||
ref: cli | ||
|
||
# Install Node.js: | ||
- name: 'Install Node.js' | ||
uses: actions/setup-node@v3 | ||
# Pin action to full length commit SHA corresponding to v3.8.1 | ||
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d | ||
with: | ||
node-version: 16 | ||
timeout-minutes: 5 | ||
|
@@ -120,7 +122,8 @@ jobs: | |
# Publish package to npm: | ||
- name: 'Publish package to npm' | ||
uses: JS-DevTools/npm-publish@v2 | ||
# Pin action to full length commit SHA corresponding to v2.2.2 | ||
uses: JS-DevTools/npm-publish@fe72237be0920f7a0cafd6a966c9b929c9466e9b | ||
with: | ||
token: ${{ secrets.NPM_TOKEN }} | ||
access: public | ||
|
@@ -132,7 +135,8 @@ jobs: | |
# Send status to Slack channel if job fails: | ||
- name: 'Send status to Slack channel in case of failure' | ||
uses: act10ns/slack@v2 | ||
# Pin action to full length commit SHA corresponding to v2.0.0 | ||
uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f | ||
with: | ||
status: ${{ job.status }} | ||
steps: ${{ toJson(steps) }} | ||
|
@@ -153,7 +157,8 @@ jobs: | |
|
||
# Cancel any running or queued workflow runs: | ||
- name: 'Cancel running or queued workflow runs' | ||
uses: styfle/[email protected] | ||
# Pin action to full length commit SHA corresponding to v0.11.0 | ||
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 | ||
with: | ||
workflow_id: >- | ||
benchmark.yml, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/** | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2019 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. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// MODULES // | ||
|
||
var tape = require( 'tape' ); | ||
var aliases = require( '@stdlib/namespace-aliases' ); | ||
var DATA = require( './../../data/data.json' ); | ||
var signature = require( './../../dist' ); | ||
|
||
|
||
// TESTS // | ||
|
||
tape( 'main export is a function', function test( t ) { | ||
t.ok( true, __filename ); | ||
t.strictEqual( typeof signature, 'function', 'main export is a function' ); | ||
t.end(); | ||
}); | ||
|
||
tape( 'the function throws an error if not provided a string', function test( t ) { | ||
var values; | ||
var i; | ||
|
||
values = [ | ||
5, | ||
NaN, | ||
true, | ||
false, | ||
null, | ||
void 0, | ||
[], | ||
{}, | ||
function noop() {} | ||
]; | ||
for ( i = 0; i < values.length; i++ ) { | ||
t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); | ||
} | ||
t.end(); | ||
|
||
function badValue( value ) { | ||
return function badValue() { | ||
signature( value ); | ||
}; | ||
} | ||
}); | ||
|
||
tape( 'the function returns one or more signatures', function test( t ) { | ||
var expected; | ||
var actual; | ||
var list; | ||
var i; | ||
var j; | ||
|
||
list = aliases(); | ||
for ( i = 0; i < list.length; i++ ) { | ||
expected = []; | ||
for ( j = 0; j < DATA.length; j++ ) { | ||
if ( DATA[ j ][ 0 ] === list[ i ] ) { | ||
expected.push( DATA[ j ][ 1 ] ); | ||
} | ||
} | ||
if ( expected.length === 0 ) { | ||
expected = null; | ||
} | ||
actual = signature( list[i] ); | ||
t.deepEqual( actual, expected, 'returns expected value for '+list[i] ); | ||
} | ||
t.end(); | ||
}); | ||
|
||
tape( 'the function returns `null` if provided an unrecognized alias', function test( t ) { | ||
var values; | ||
var i; | ||
|
||
values = [ | ||
'adfkaljdfdsafs', | ||
'adklfadjflajdslfjalsdf', | ||
'adflkajdlkfjasdlkfjsadlkfjlasdjflsdjfla' | ||
]; | ||
for ( i = 0; i < values.length; i++ ) { | ||
t.strictEqual( signature( values[ i ] ), null, 'returns expected value' ); | ||
} | ||
t.end(); | ||
}); |