Skip to content

Commit 8edb71d

Browse files
skoriopPlaneshifterkgryte
authored
test: add tests to utils/circular-buffer
PR-URL: #1403 Ref: #474 --------- Signed-off-by: Philipp Burckhardt <[email protected]> Co-authored-by: Philipp Burckhardt <[email protected]> Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Philipp Burckhardt <[email protected]>
1 parent 71af75e commit 8edb71d

File tree

1 file changed

+13
-0
lines changed
  • lib/node_modules/@stdlib/utils/circular-buffer/docs/types

1 file changed

+13
-0
lines changed

lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts

+13
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,23 @@ import CircularBuffer = require( './index' );
2929
// The function returns a circular buffer instance...
3030
{
3131
new CircularBuffer( 3 ); // $ExpectType CircularBuffer<unknown>
32+
new CircularBuffer( [ 1, 2, 3 ] ); // $ExpectType CircularBuffer<number>
33+
new CircularBuffer( 'abc' ); // $ExpectType CircularBuffer<string>
34+
new CircularBuffer( { 'length': 10 } ); // $ExpectType CircularBuffer<unknown>
3235
}
3336

3437
// The compiler throws an error if the constructor function is provided an invalid number of arguments...
3538
{
3639
new CircularBuffer(); // $ExpectError
3740
new CircularBuffer( 3, 4 ); // $ExpectError
3841
}
42+
43+
// The compiler throws an error if the constructor function is provided a first argument which is not a number or an array-like object...
44+
{
45+
new CircularBuffer( true ); // $ExpectError
46+
new CircularBuffer( false ); // $ExpectError
47+
new CircularBuffer( null ); // $ExpectError
48+
new CircularBuffer( undefined ); // $ExpectError
49+
new CircularBuffer( {} ); // $ExpectError
50+
new CircularBuffer( ( x: number ): number => x ); // $ExpectError
51+
}

0 commit comments

Comments
 (0)