Skip to content

Commit 459b0f3

Browse files
committed
test: add test and document that arguments are optional
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent f29381d commit 459b0f3

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

lib/node_modules/@stdlib/console/log-each/lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var logger = require( '@stdlib/console/log' );
3333
* Inserts array element values into a format string and prints the result.
3434
*
3535
* @param {string} str - format string
36-
* @param {...(Collection|*)} args - collections or values
36+
* @param {...(Collection|*)} [args] - collections or values
3737
* @throws {TypeError} first argument must be a string
3838
* @throws {RangeError} provided collections must have the same length
3939
* @returns {void}

lib/node_modules/@stdlib/console/log-each/test/test.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,31 @@ tape( 'the function throws an error if not provided collections with the same le
113113
}
114114
});
115115

116+
tape( 'the function prints a formatted message', function test( t ) {
117+
var expected;
118+
var logEach;
119+
var i;
120+
var j;
121+
122+
logEach = proxyquire( './../lib/main.js', {
123+
'@stdlib/console/log': logger
124+
});
125+
126+
j = 0;
127+
expected = [ 'foo', 'foo', 'foo' ];
128+
129+
for ( i = 0; i < expected.length; i++ ) {
130+
logEach( 'foo' );
131+
}
132+
t.strictEqual( j, expected.length, 'returns expected value' );
133+
t.end();
134+
135+
function logger( str ) {
136+
t.equal( str, expected[ j ], 'returns expected value' );
137+
j += 1;
138+
}
139+
});
140+
116141
tape( 'the function prints a formatted message for each element in an array', function test( t ) {
117142
var expected;
118143
var logEach;

0 commit comments

Comments
 (0)