Skip to content

Commit

Permalink
Merge branch 'main' into entity-fields
Browse files Browse the repository at this point in the history
  • Loading branch information
joshreisner committed Oct 3, 2024
2 parents 0845743 + 70f8db2 commit fd30026
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 3 deletions.
4 changes: 2 additions & 2 deletions public/app.js

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions public/tests/flags.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="description" content="React JS recovery meeting finder demo" />
<link rel="icon" type="image/png" href="/logo.png" />
<title>Meetings</title>
</head>
<body>
<div
id="tsml-ui"
data-src="https://sheets.code4recovery.org/storage/12Ga8uwMG4WJ8pZ_SEU7vNETp_aQZ-2yNVsYDFqIwHyE.json"
data-mapbox="pk.eyJ1Ijoiam9zaHJlaXNuZXIiLCJhIjoiY2tvYXA0YnZxMGRldDJxbzdta25uNGphdiJ9.eay-UKgIT99ALmdw08xBPw"
data-timezone="America/Los_Angeles"
></div>
<script>
var tsml_react_config = { 'flags': ['M', 'W', 'O', 'C'] };
</script>
<script src="/app.js" async></script>
</body>
</html>
2 changes: 1 addition & 1 deletion src/components/Meeting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export default function Meeting({
});
if (meeting[`contact_${i}_phone` as keyof typeof Meeting])
contactButtons.push({
href: `tel:${meeting[`contact_${i}_phone` as keyof typeof Meeting]}`,
href: `sms:${meeting[`contact_${i}_phone` as keyof typeof Meeting]}`,
icon: 'text',
text: i18n(strings.contact_text, {
contact: meeting[`contact_${i}_name` as keyof typeof Meeting],
Expand Down
30 changes: 30 additions & 0 deletions test/__tests__/Meeting.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ describe('<Meeting />', () => {
conference_phone_notes: 'Test',
conference_provider: 'Zoom',
updated: '2/17/22',
contact_1_name: 'Contact 1',
contact_1_email: '[email protected]',
contact_1_phone: '+18005551212',
contact_2_email: '[email protected]',
contact_2_phone: '+18005551212',
};

const mockState: State = {
Expand Down Expand Up @@ -140,6 +145,31 @@ describe('<Meeting />', () => {
expect(container).toBeTruthy();
});

it('renders with contact 1 but no contact 2', () => {
const { getByText, queryByText } = render(
<MemoryRouter>
<Meeting
state={mockState}
setState={jest.fn()}
mapbox="pk.123456"
feedback_emails={['[email protected]']}
/>
</MemoryRouter>
);
const contact1text = getByText(`Text ${mockMeeting.contact_1_name}`);
expect(contact1text).toHaveAttribute(
'href',
`sms:${mockMeeting.contact_1_phone}`
);
const contact1email = getByText(`Email ${mockMeeting.contact_1_name}`);
expect(contact1email).toHaveAttribute(
'href',
`mailto:${mockMeeting.contact_1_email}`
);
const contact2text = queryByText(`Text ${mockMeeting.contact_2_name}`);
expect(contact2text).toBeNull();
});

it('renders when inactive', () => {
const { container } = render(
<MemoryRouter>
Expand Down

0 comments on commit fd30026

Please sign in to comment.