Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jobs:
Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v6
with:
node-version: 14
- name: Install dependencies
Expand All @@ -23,11 +23,10 @@ jobs:
runs-on: ubuntu-latest
name: Check formatting
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 16
- run: npm install
- uses: sibiraj-s/action-eslint@v2
with:
eslint-args: "src"
- name: Run ESLint
run: npx eslint src
6 changes: 3 additions & 3 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jobs:
Publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v6
with:
node-version: 14
- name: Install dependencies
Expand All @@ -20,7 +20,7 @@ jobs:
- name: Build static site
run: CI="" npm run build
- name: Deploy to GItHub Pages
uses: JamesIves/github-pages-deploy-action@releases/v3
uses: JamesIves/github-pages-deploy-action@v4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
Expand Down
59 changes: 0 additions & 59 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,65 +16,6 @@ class HouseholdInfo {
}
}

class ExpenditureInfo{
constructor({new_clean_vehicle_classification,
new_clean_vehicle_msrp,
purchased_qualifying_new_clean_vehicle, used_clean_vehicle_sale_price,residential_efficiency_electrification_retrofit_expenditures,
residential_efficiency_electrification_retrofit_energy_savings,
home_energy_audit_expenditures,
energy_efficient_door_expenditures,
energy_efficient_insulation_expenditures,
energy_efficient_roof_expenditures,
energy_efficient_window_expenditures,
advanced_main_air_circulating_fan_expenditures,
air_sealing_ventilation_expenditures,
biomass_stove_boiler_expenditures,
electric_heat_pump_clothes_dryer_expenditures,
electric_load_service_center_upgrade_expenditures,
electric_stove_cooktop_range_or_oven_expenditures,
electric_wiring_expenditures,
energy_efficient_central_air_conditioner_expenditures,
heat_pump_expenditures,
heat_pump_water_heater_expenditures,
qualified_furnace_or_hot_water_boiler_expenditures,
fuel_cell_property_capacity,
fuel_cell_property_expenditures,
geothermal_heat_pump_property_expenditures,
qualified_battery_storage_technology_expenditures,
small_wind_energy_property_expenditures,
solar_electric_property_expenditures,
solar_water_heating_property_expenditures}){
this.new_clean_vehicle_classification = new_clean_vehicle_classification;
this.new_clean_vehicle_msrp = new_clean_vehicle_msrp;
this.purchased_qualifying_new_clean_vehicle = purchased_qualifying_new_clean_vehicle;
this.used_clean_vehicle_sale_price = used_clean_vehicle_sale_price;
this.residential_efficiency_electrification_retrofit_expenditures = residential_efficiency_electrification_retrofit_expenditures;
this.residential_efficiency_electrification_retrofit_energy_savings = residential_efficiency_electrification_retrofit_energy_savings;
this.home_energy_audit_expenditures = home_energy_audit_expenditures;
this.energy_efficient_door_expenditures = energy_efficient_door_expenditures;
this.energy_efficient_insulation_expenditures = energy_efficient_insulation_expenditures;
this.energy_efficient_roof_expenditures = energy_efficient_roof_expenditures;
this.energy_efficient_window_expenditures = energy_efficient_window_expenditures;
this.air_sealing_ventilation_expenditures = air_sealing_ventilation_expenditures;
this.biomass_stove_boiler_expenditures = biomass_stove_boiler_expenditures;
this.advanced_main_air_circulating_fan_expenditures = advanced_main_air_circulating_fan_expenditures;
this.electric_heat_pump_clothes_dryer_expenditures = electric_heat_pump_clothes_dryer_expenditures;
this.electric_load_service_center_upgrade_expenditures = electric_load_service_center_upgrade_expenditures;
this.electric_stove_cooktop_range_or_oven_expenditures = electric_stove_cooktop_range_or_oven_expenditures;
this.electric_wiring_expenditures = electric_wiring_expenditures;
this.energy_efficient_central_air_conditioner_expenditures = energy_efficient_central_air_conditioner_expenditures;
this.heat_pump_expenditures = heat_pump_expenditures;
this.heat_pump_water_heater_expenditures = heat_pump_water_heater_expenditures;
this.qualified_furnace_or_hot_water_boiler_expenditures = qualified_furnace_or_hot_water_boiler_expenditures;
this.fuel_cell_property_capacity = fuel_cell_property_capacity;
this.fuel_cell_property_expenditures = fuel_cell_property_expenditures;
this.geothermal_heat_pump_property_expenditures = geothermal_heat_pump_property_expenditures;
this.qualified_battery_storage_technology_expenditures = qualified_battery_storage_technology_expenditures;
this.small_wind_energy_property_expenditures = small_wind_energy_property_expenditures;
this.solar_electric_property_expenditures = solar_electric_property_expenditures;
this.solar_water_heating_property_expenditures = solar_water_heating_property_expenditures;
}
}
function App() {

// TODO: begin with a null household in the PR that creates Household component.
Expand Down
31 changes: 24 additions & 7 deletions src/App.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
import { render, screen, act } from '@testing-library/react';
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import App from './App';

test('reaches correct result', async () => {
act(() => { // eslint-disable-line
render(<App />);
test('shows clean vehicle credit result', async () => {
window.fetch = jest.fn(() =>
Promise.resolve({
json: () =>
Promise.resolve({
tax_units: {
tax_unit: {
new_clean_vehicle_credit: { 2023: 7500 },
},
},
}),
})
);

render(<App />);
fireEvent.click(screen.getByRole('button', { name: /simulate ev credits/i }));

await waitFor(() => {
expect(
screen.getByText(
"You're eligible: your eligible new clean vehicle credit is $7500."
)
).toBeInTheDocument();
});
await new Promise((r) => setTimeout(r, 2000));
const linkElement = screen.getByText("The heat pump rebate for $10k in heat pump expenditures in 2023 is $8000.");
expect(linkElement).toBeInTheDocument();
});