import {
  AI_BUTTON_GRADIENT_LOCATION_DEFAULT,
  AI_BUTTON_GRADIENT_LOCATION_EXPANDED,
} from '../../constants';
import {getGradientLocations} from './utils';

describe('getGradientLocations', () => {
  it('returns default blue stop at progress 0', () => {
    expect(getGradientLocations(0)).toEqual([
      0,
      AI_BUTTON_GRADIENT_LOCATION_DEFAULT,
    ]);
  });

  it('returns expanded blue stop at progress 1', () => {
    expect(getGradientLocations(1)).toEqual([
      0,
      AI_BUTTON_GRADIENT_LOCATION_EXPANDED,
    ]);
  });

  it('interpolates linearly at progress 0.5', () => {
    const expectedBlueStop =
      AI_BUTTON_GRADIENT_LOCATION_DEFAULT +
      (AI_BUTTON_GRADIENT_LOCATION_EXPANDED -
        AI_BUTTON_GRADIENT_LOCATION_DEFAULT) *
        0.5;

    expect(getGradientLocations(0.5)).toEqual([0, expectedBlueStop]);
  });
});
