<commit_before>import { getSNAPBenefits } from '../../../programs/federal/snap';

// CLIENTS
import { CLIENT_DEFAULTS } from '../../../utils/CLIENT_DEFAULTS';
import { cloneDeep } from 'lodash';

const defaultClient       = cloneDeep( CLIENT_DEFAULTS );
const variant1            = cloneDeep( CLIENT_DEFAULTS );
variant1.current.hasSnap  = true;
variant1.current.household.push( {"m_age":30,"m_role":"head","m_disabled":false} );
variant1.current.household.push( {"m_age":30,"m_role":"spouse","m_disabled":false} );
variant1.current.household.push( {"m_age":12,"m_role":"member","m_disabled":false} );
variant1.current.earned   = 2165;
variant1.current.shelter  = "renter";
variant1.current.rent     = 600;
// SNAP never needs to test future
// Housing only changes earned income in future
variant1.future           = cloneDeep( variant1.current );

describe('getSNAPBenefits', () => {
  describe('default client', () => {
    it('Should calculate the correct current benefits', () => {
      expect(getSNAPBenefits(defaultClient, 'current')).toEqual(192);
    });
    
    it('Should calculate the correct future benefits', () => {
      expect(getSNAPBenefits(defaultClient, 'future')).toEqual(192);
    });
  });
  describe('variant 1', () => {
    it('Should calculate the correct current benefits', () => {
      expect(getSNAPBenefits(variant1, 'current')).toBeCloseTo(32.4, 4);
    });
    
    it('Should calculate the correct future benefits', () => {
      expect(getSNAPBenefits(variant1, 'future')).toBeCloseTo(32.4, 4);
    });
  });
});<commit_msg>Fixes extra head of household<commit_after>import { getSNAPBenefits } from '../../../programs/federal/snap';

// CLIENTS
import { CLIENT_DEFAULTS } from '../../../utils/CLIENT_DEFAULTS';
import { cloneDeep } from 'lodash';

const defaultClient       = cloneDeep( CLIENT_DEFAULTS );
const variant1            = cloneDeep( CLIENT_DEFAULTS );
variant1.current.hasSnap  = true;
// Head of household member is already there
variant1.current.household.push( {"m_age":30,"m_role":"spouse","m_disabled":false} );
variant1.current.household.push( {"m_age":12,"m_role":"member","m_disabled":false} );
variant1.current.earned   = 2165;
variant1.current.shelter  = "renter";
variant1.current.rent     = 600;
// SNAP never needs to test future
// Housing only changes earned income in future
variant1.future           = cloneDeep( variant1.current );

describe('getSNAPBenefits', () => {
  describe('default client', () => {
    it('Should calculate the correct current benefits', () => {
      expect(getSNAPBenefits(defaultClient, 'current')).toEqual(192);
    });
    
    it('Should calculate the correct future benefits', () => {
      expect(getSNAPBenefits(defaultClient, 'future')).toEqual(192);
    });
  });
  describe('variant 1', () => {
    it('Should calculate the correct current benefits', () => {
      expect(getSNAPBenefits(variant1, 'current')).toBeCloseTo(32.4, 4);
    });
    
    it('Should calculate the correct future benefits', () => {
      expect(getSNAPBenefits(variant1, 'future')).toBeCloseTo(32.4, 4);
    });
  });
});
{'fraction_non_alphanumeric': 0.16930022573363432, 'fraction_numerical': 0.024830699774266364, 'mean_word_length': 4.04390243902439, 'pattern_counts': {'":': 15, '<': 3, '<?xml version=': 0, '>': 17, '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': '7543282', 'n_tokens_mistral': 1001, 'n_tokens_neox': 973, 'n_words': 189}