Files
optolith-client/js/utils/__tests__/iccalc-test.js
T
Lukas Obermann 7c229853e7 Updated babel, fixing data flow in ListStore
Transferring all Actions to ListStore to regain unidirectional data flow for all stores. Other Stores only will store section-specific data e.g. filters.
2016-11-02 02:23:02 +01:00

29 lines
619 B
JavaScript

jest.mock('../../stores/APStore');
import APStore from '../../stores/APStore';
import iccalc, { getIC } from '../iccalc';
describe('iccalc', () => {
APStore.getAvailable.mockReturnValue(24);
it('returns 45 ap cost for SR 16 IC 5', () => {
const ap = getIC(5, 16);
expect(ap).toBe(45);
});
it('returns 4 ap cost for activating IC 4', () => {
const ap = getIC(4, 0);
expect(ap).toBe(4);
});
it('accepts to get 15 AP back', () => {
const valid = iccalc(-15);
expect(valid).toBe(true);
});
it('fails to buy IC 4 SR 18', () => {
const valid = iccalc(4, 18);
expect(valid).toBe(false);
});
});