From 1361804c657299f40721881c894e3e9ca931e676 Mon Sep 17 00:00:00 2001 From: skoriop Date: Wed, 28 Feb 2024 05:41:46 +0530 Subject: [PATCH 1/3] test: add missing tests to `utils/circular-buffer` --- .../utils/circular-buffer/docs/types/test.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts b/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts index a5f1f9a0feff..9c51b0d29574 100644 --- a/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts +++ b/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts @@ -26,13 +26,30 @@ import CircularBuffer = require( './index' ); // TESTS // -// The function returns a circular buffer instance... +// The function returns a circular buffer instance if the constructor function is provided a first argument which is a number... { new CircularBuffer( 3 ); // $ExpectType CircularBuffer } +// The function returns a circular buffer instance if the constructor function is provided a first argument which is an array-like object... +{ + new CircularBuffer( [ 1, 2, 3 ] ); // $ExpectType CircularBuffer + new CircularBuffer( 'abc' ); // $ExpectType CircularBuffer + new CircularBuffer( { 'length': 10 } ); // $ExpectType CircularBuffer +} + // 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 +} From bbee2823434b1dd532c17bbabd9054a01c45c051 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Sat, 7 Sep 2024 13:42:48 -0400 Subject: [PATCH 2/3] chore: update comment Co-authored-by: Athan Signed-off-by: Philipp Burckhardt --- .../@stdlib/utils/circular-buffer/docs/types/test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts b/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts index 9c51b0d29574..e45bcc239d32 100644 --- a/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts +++ b/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts @@ -26,7 +26,7 @@ import CircularBuffer = require( './index' ); // TESTS // -// The function returns a circular buffer instance if the constructor function is provided a first argument which is a number... +// The function returns a circular buffer instance... { new CircularBuffer( 3 ); // $ExpectType CircularBuffer } From 4da03d888e14327596ddb1802f663e2b98566db3 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Sat, 7 Sep 2024 13:43:21 -0400 Subject: [PATCH 3/3] chore: collapse tests Signed-off-by: Philipp Burckhardt --- .../@stdlib/utils/circular-buffer/docs/types/test.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts b/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts index e45bcc239d32..bf7827cd7b82 100644 --- a/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts +++ b/lib/node_modules/@stdlib/utils/circular-buffer/docs/types/test.ts @@ -29,10 +29,6 @@ import CircularBuffer = require( './index' ); // The function returns a circular buffer instance... { new CircularBuffer( 3 ); // $ExpectType CircularBuffer -} - -// The function returns a circular buffer instance if the constructor function is provided a first argument which is an array-like object... -{ new CircularBuffer( [ 1, 2, 3 ] ); // $ExpectType CircularBuffer new CircularBuffer( 'abc' ); // $ExpectType CircularBuffer new CircularBuffer( { 'length': 10 } ); // $ExpectType CircularBuffer