<commit_before>import { endOfDay, endOfMonth, getUnixTime } from 'date-fns';
import numericHash from 'string-hash';

import { getLongTermRates, getOverviewGraphValues } from './graph';
import { State } from '~client/reducers/types';
import { testState } from '~client/test-data';
import { LongTermOptions } from '~client/types';
import { PageListStandard } from '~client/types/gql';
import { PageNonStandard } from '~shared/constants';

const now = new Date('2018-03-23T11:54:23.127Z');
const today = endOfDay(now);

describe('getOverviewGraphValues', () => {
  const stateZeroed: State = {
    ...testState,
    overview: {
      ...testState.overview,
      startDate: new Date('2018-01-31'),
      endDate: new Date('2018-06-30'),
      monthly: {
        ...testState.overview.monthly,
        income: Array(6).fill(0),
        bills: Array(6).fill(0),
        food: Array(6).fill(0),
        general: Array(6).fill(0),
        holiday: Array(6).fill(0),
        social: Array(6).fill(0),
        investmentPurchases: Array(6).fill(0),
      },
      stocks: Array(3).fill(0),
      futureIncome: [],
      annualisedFundReturns: 0,
    },
    netWorth: {
      ...testState.netWorth,
      entries: [],
    },
    [PageNonStandard.Funds]: {
      ...testState[PageNonStandard.Funds],
      items: [],
      startTime: 0,
      cacheTimes: [],
      prices: {},
      todayPrices: {},
    },
  };

  describe('income values', () => {<commit_msg>fix(client): set todayPriceFetchTime in tests<commit_after>import { endOfDay, endOfMonth, getUnixTime, subSeconds } from 'date-fns';
import numericHash from 'string-hash';

import { getLongTermRates, getOverviewGraphValues } from './graph';
import { State } from '~client/reducers/types';
import { testState } from '~client/test-data';
import { LongTermOptions } from '~client/types';
import { PageListStandard } from '~client/types/gql';
import { PageNonStandard } from '~shared/constants';

const now = new Date('2018-03-23T11:54:23.127Z');
const today = endOfDay(now);

describe('getOverviewGraphValues', () => {
  const stateZeroed: State = {
    ...testState,
    overview: {
      ...testState.overview,
      startDate: new Date('2018-01-31'),
      endDate: new Date('2018-06-30'),
      monthly: {
        ...testState.overview.monthly,
        income: Array(6).fill(0),
        bills: Array(6).fill(0),
        food: Array(6).fill(0),
        general: Array(6).fill(0),
        holiday: Array(6).fill(0),
        social: Array(6).fill(0),
        investmentPurchases: Array(6).fill(0),
      },
      stocks: Array(3).fill(0),
      futureIncome: [],
      annualisedFundReturns: 0,
    },
    netWorth: {
      ...testState.netWorth,
      entries: [],
    },
    [PageNonStandard.Funds]: {
      ...testState[PageNonStandard.Funds],
      items: [],
      startTime: 0,
      cacheTimes: [],
      prices: {},
      todayPrices: {},
      todayPriceFetchTime: subSeconds(now, 4),
    },
  };

  describe('income values', () => {
{'fraction_non_alphanumeric': 0.16694546671127466, 'fraction_numerical': 0.03445968551354968, 'mean_word_length': 2.9290407358738504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5385361', 'n_tokens_mistral': 1033, 'n_tokens_neox': 979, 'n_words': 186}