Skip to content
Open
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
2 changes: 1 addition & 1 deletion client/src/components/PayBill.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const PayBill = (props) => {
return (<BillCard info={info} index={index} onClick={onChange} />);
})}
</div>
<div ref={paypal} />
<div ref={paypal} id="paypal-btn" />
</div>
}
{submit && <ThankYou />}
Expand Down
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"jest": "^27.2.0",
"jest-dom": "^4.0.0",
"nodemon": "^2.0.12",
"react-helmet": "^6.1.0",
"webpack": "^5.53.0",
"webpack-cli": "^4.8.0"
},
Expand Down
34 changes: 34 additions & 0 deletions tests/paybill.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { render, screen, cleanup } from '@testing-library/react';
import '@testing-library/jest-dom';
import React from 'react';
import PayBill from '../client/src/components/PayBill.jsx';
import { Helmet } from "react-helmet";
afterEach(cleanup);



describe('Paybill page can render properly', () => {
test('can render page correctly', () => {
let hostInfo = {
email: "[email protected]",
guestName: "Ming Ma",
id: 133
}
let finalTotals = {
paymentsOwed: {
"Ming Ma": 32.1,
"Sara": 37.3,
"Milo": 30.1
}
}
render(
<div>
<Helmet>
<script
src="https://www.paypal.com/sdk/js?client-id=AcuzwYns3SuSSdJfwStMFCPsnRV3Ohu3ebkRskSvHlnR0p3UXVuhIcMbdUXpsBY6ISfepv7yQ2YQtpCC" />
<PayBill finalTotals={finalTotals} hostInfo={hostInfo} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this injects your PayBill component into the head of the page? Not super familiar with helmet, but I don't know if this is correct

Copy link
Contributor Author

@MingHacker MingHacker Sep 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I think you are right, the paybill should be out of the helmet, now the Paybill's test coverage is just 6% which means most are not rendered yet....I'll look into this.

</Helmet>);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rogue parentheses before the end of the render block

</div>
)
})
})