File "find.test.ts"
Full path: /home/fsibplc/public_html/sommilito-bank2/splide-4.1.3/src/js/utils/arrayLike/find/find.test.ts
File
size: 635 B (635 B bytes)
MIME-type: text/x-java
Charset: utf-8
Download Open Edit Advanced Editor Back
import { find } from './find';
describe( 'find', () => {
test( 'can find a value in an array-like object that satisfies the predicate function.', () => {
const arrayLike = { length: 3, 0: '1', 1: '2', 2: '3' };
expect( find( arrayLike, value => value === '2' ) ).toBe( '2' );
expect( find( arrayLike, ( value, index ) => index > 1 ) ).toBe( '3' );
} );
test( 'can find a value in an array that satisfies the predicate function.', () => {
const array = [ 1, 2, 3 ];
expect( find( array, value => value === 2 ) ).toBe( 2 );
expect( find( array, ( value, index ) => index > 1 ) ).toBe( 3 );
} );
} );