import { getDotState, getDotDirection, getButtonPlacement } from '../utils';

describe('getDotDirection', () => {
  it.each`
    dotPlacement | state
    ${'top'}     | ${'row'}
    ${'bottom'}  | ${'row'}
    ${'left'}    | ${'column'}
    ${'right'}   | ${'column'}
  `(
    'returns $state when placement is $placement',
    ({ dotPlacement, state }) => {
      expect(getDotDirection({ dotPlacement })).toEqual(state);
    }
  );
});

describe('getDotState', () => {
  it.each`
    active   | dotPlacement | state
    ${true}  | ${'top'}     | ${'activeRow'}
    ${true}  | ${'bottom'}  | ${'activeRow'}
    ${true}  | ${'left'}    | ${'activeColumn'}
    ${true}  | ${'right'}   | ${'activeColumn'}
    ${false} | ${'top'}     | ${'defaultRow'}
    ${false} | ${'bottom'}  | ${'defaultRow'}
    ${false} | ${'left'}    | ${'defaultColumn'}
    ${false} | ${'right'}   | ${'defaultColumn'}
  `(
    'returns $state when placement is $placement and active is $active',
    ({ active, dotPlacement, state }) => {
      expect(getDotState({ active, dotPlacement })).toEqual(state);
    }
  );
});

describe('getButtonPlacement', () => {
  it.each`
    dotPlacement | state
    ${'top'}     | ${'middleRow'}
    ${'bottom'}  | ${'middleRow'}
    ${'left'}    | ${'leftColumn'}
    ${'right'}   | ${'rightColumn'}
  `(
    'returns $state when placement is $placement',
    ({ dotPlacement, state }) => {
      expect(getButtonPlacement({ dotPlacement })).toEqual(state);
    }
  );
});
