1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  *
    
  7.  * @flow
    
  8.  */
    
  9. 
    
  10. import {clamp} from '../clamp';
    
  11. 
    
  12. describe(clamp, () => {
    
  13.   it('should return min if value < min', () => {
    
  14.     expect(clamp(0, 1, -1)).toBe(0);
    
  15.     expect(clamp(0.1, 1.1, 0.05)).toBe(0.1);
    
  16.   });
    
  17. 
    
  18.   it('should return value if min <= value <= max', () => {
    
  19.     expect(clamp(0, 1, 0)).toBe(0);
    
  20.     expect(clamp(0, 1, 0.5)).toBe(0.5);
    
  21.     expect(clamp(0, 1, 1)).toBe(1);
    
  22.     expect(clamp(0.1, 1.1, 0.15)).toBe(0.15);
    
  23.   });
    
  24. 
    
  25.   it('should return max if max < value', () => {
    
  26.     expect(clamp(0, 1, 2)).toBe(1);
    
  27.     expect(clamp(0.1, 1.1, 1.15)).toBe(1.1);
    
  28.   });
    
  29. });