Skip to content

test: add missing tests to utils/circular-buffer #1403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,23 @@ import CircularBuffer = require( './index' );
// The function returns a circular buffer instance...
{
new CircularBuffer( 3 ); // $ExpectType CircularBuffer<unknown>
new CircularBuffer( [ 1, 2, 3 ] ); // $ExpectType CircularBuffer<number>
new CircularBuffer( 'abc' ); // $ExpectType CircularBuffer<string>
new CircularBuffer( { 'length': 10 } ); // $ExpectType CircularBuffer<unknown>
}

// The compiler throws an error if the constructor function is provided an invalid number of arguments...
{
new CircularBuffer(); // $ExpectError
new CircularBuffer( 3, 4 ); // $ExpectError
}

// The compiler throws an error if the constructor function is provided a first argument which is not a number or an array-like object...
{
new CircularBuffer( true ); // $ExpectError
new CircularBuffer( false ); // $ExpectError
new CircularBuffer( null ); // $ExpectError
new CircularBuffer( undefined ); // $ExpectError
new CircularBuffer( {} ); // $ExpectError
new CircularBuffer( ( x: number ): number => x ); // $ExpectError
}
Loading