File "clamp.test.ts"

Full path: /home/fsibplc/public_html/sommilito-bank2/splide-4.1.3/src/js/utils/math/clamp/clamp.test.ts
File size: 366 B (366 B bytes)
MIME-type: text/x-java
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

import { clamp } from './clamp';


describe( 'clamp', () => {
  test( 'can clamp a number', () => {
    expect( clamp( 0, 0, 1 ) ).toBe( 0 );
    expect( clamp( 1, 0, 1 ) ).toBe( 1 );

    expect( clamp( 1, 2, 3 ) ).toBe( 2 );
    expect( clamp( 1, 0, 0 ) ).toBe( 0 );

    expect( clamp( 3, 0, 1 ) ).toBe( 1 );
    expect( clamp( 3, 4, 5 ) ).toBe( 4 );
  } );
} );