binary-com/binary-next-gen

View on GitHub
src/portfolio/__tests__/indicativeTotalSelector-test.js

Summary

Maintainability
C
1 day
Test Coverage
import { fromJS } from 'immutable';
import { indicativeTotalSelector } from '../PortfolioSelectors';

describe('indicativeTotal', () => {
     it('should equal 0 for emtpy proposal list', () => {
         const actual = indicativeTotalSelector({
             boughtContracts: fromJS({}),
         });
         expect(actual).toEqual(0);
     });

     it('should equal the sell price of a single proposal', () => {
         const actual = indicativeTotalSelector({
             boughtContracts: fromJS({
                 1: { contract_id: 1, bid_price: 10 },
             }),
         });
         expect(actual).toEqual(10);
     });

     it('should equal the sum of proposal bid prices', () => {
         const actual = indicativeTotalSelector({
             boughtContracts: fromJS({
                 1: { contract_id: 1, bid_price: 1 },
                 2: { contract_id: 2, bid_price: 2 },
                 3: { contract_id: 3, bid_price: 3 },
             }),
         });
         expect(actual).toEqual(6);
     });
 });