import deepFreeze from 'deep-freeze';
import getMerits from './getMerits';

it('should return correct initial values for merits', () => {
  const state = {
    character: {
      basicInfo: {
        clan: { name: '' }
      },
      merits: [],
      flaws: [],
      morality: {
        path: 'Humanity'
      }
    }
  };

  deepFreeze(state);

  const result = getMerits(state);

  expect(result).toEqual({
    selected: [],
    currentPoints: 0,
    availablePoints: 7
  });
});

it('should return correct values for merits', () => {
  const state = {
    character: {
      basicInfo: {
        clan: { name: '' }
      },
      merits: [
        {
          name: 'Ambidextrous',
          points: 2
        },
        {
          name: 'Calm Heart',
          points: 1
        },
        {
          name: 'Clear Sighted',
          points: 3
        }
      ],
      flaws: [
        {
          name: 'Bad Sight',
          points: 2
        }
      ],
      morality: {
        path: 'Humanity'
      }
    }
  };

  deepFreeze(state);

  const result = getMerits(state);

  expect(result).toEqual({
    selected: state.character.merits,
    currentPoints: 6,
    availablePoints: 1
  });
});

it('should include morality merits', () => {
  const state = {
    character: {
      basicInfo: {
        clan: { name: '' }
      },
      merits: [
        {
          name: 'Calm Heart',
          points: 1
        },
        {
          name: 'Clear Sighted',
          points: 3
        }
      ],
      flaws: [
        {
          name: 'Bad Sight',
          points: 2
        }
      ],
      morality: {
        path: 'Path of Metamorphosis',
        meritPoints: 2,
        startingDots: 4
      }
    }
  };

  deepFreeze(state);

  const result = getMerits(state);

  expect(result).toEqual({
    selected: state.character.merits,
    currentPoints: 6,
    availablePoints: 1
  });
});

it('should include bloodline merits', () => {
  const state = {
    character: {
      basicInfo: {
        clan: {
          name: 'Tzimisce',
          bloodline: 'Koldun',
          meritPoints: 4
        }
      },
      merits: [
        {
          name: 'Calm Heart',
          points: 1
        }
      ],
      flaws: [
        {
          name: 'Bad Sight',
          points: 2
        }
      ],
      morality: {
        path: 'Humanity'
      }
    }
  };

  deepFreeze(state);

  const result = getMerits(state);

  expect(result).toEqual({
    selected: state.character.merits,
    currentPoints: 5,
    availablePoints: 2
  });
});

it('should include morality and bloodline merits', () => {
  const state = {
    character: {
      basicInfo: {
        clan: {
          name: 'Tzimisce',
          bloodline: 'Koldun',
          meritPoints: 4
        }
      },
      merits: [],
      flaws: [],
      morality: {
        path: 'Path of Metamorphosis',
        meritPoints: 2,
        startingDots: 4
      }
    }
  };

  deepFreeze(state);

  const result = getMerits(state);

  expect(result).toEqual({
    selected: state.character.merits,
    currentPoints: 6,
    availablePoints: 1
  });
});

@@ -1191,32 +1191,623 @@
 s: 1%0A  %7D);%0A%7D);%0A%0A
+it('should return correct values for merits when multiple', () =%3E %7B%0A  const state = %7B%0A    character: %7B%0A      basicInfo: %7B%0A        clan: %7B name: '' %7D%0A      %7D,%0A      merits: %5B%0A        %7B%0A          name: 'Skill Aptitude',%0A          points: 2%0A        %7D,%0A        %7B%0A          name: 'Skill Aptitude',%0A          points: 2%0A        %7D%0A      %5D,%0A      flaws: %5B%5D,%0A      morality: %7B%0A        path: 'Humanity'%0A      %7D%0A    %7D%0A  %7D;%0A%0A  deepFreeze(state);%0A%0A  const result = getMerits(state);%0A%0A  expect(result).toEqual(%7B%0A    selected: state.character.merits,%0A    currentPoints: 4,%0A    availablePoints: 3%0A  %7D);%0A%7D);%0A%0A
 it('should inclu

Add test for selector