Skip to content

Commit 1405776

Browse files
committed
1 parent 409f786 commit 1405776

File tree

4 files changed

+49
-7
lines changed

4 files changed

+49
-7
lines changed

src/components/ContactUs.test.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* @vitest-environment jsdom
3+
*/
4+
import { TestProvider } from '@/lib/test/TestProvider';
5+
import { cleanup, render, screen } from '@testing-library/react';
6+
import { act } from 'react';
7+
import { afterEach, describe, expect, it } from 'vitest';
8+
import { ContactUs } from './ContactUs';
9+
10+
afterEach(() => cleanup);
11+
12+
describe(ContactUs, () => {
13+
it('should render a Discord link', async () => {
14+
render(<TestProvider>
15+
<ContactUs />
16+
</TestProvider>);
17+
18+
await act(() => null);
19+
20+
const link = screen.getByText('Contact us');
21+
expect(link).toBeTruthy();
22+
const href = link.getAttribute('href');
23+
expect(href).toEqual(expect.stringContaining('discord.com'));
24+
});
25+
26+
it('should render an email link', async () => {
27+
render(<TestProvider>
28+
<ContactUs overEmail={true} />
29+
</TestProvider>);
30+
31+
await act(() => null);
32+
33+
const link = screen.getByText('Contact us');
34+
expect(link).toBeTruthy();
35+
const href = link.getAttribute('href');
36+
expect(href).toEqual(expect.stringContaining('mailto:'));
37+
});
38+
});

src/components/ContactUs.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
export function ContactUs() {
2-
return (<a href="https://discord.com/channels/1415002037439041710/1415002038286286994" target="_blank" className="underline">
3-
Contact us
4-
</a>);
1+
export function ContactUs({ overEmail }: { readonly overEmail?: boolean }) {
2+
return (
3+
<a
4+
href={overEmail ? 'mailto:[email protected]' : 'https://discord.com/channels/1415002037439041710/1415002038286286994'}
5+
target="_blank"
6+
className="underline">
7+
Contact us
8+
</a>);
59
}

src/features/clusters/upsert/ClusterBilling.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function ClusterBilling({
6161
this page.
6262
</li>
6363
<li>Your account representative can work with you to sort out more precise details, and to help
64-
accomplish your objectives with this cluster. <ContactUs />, we are here to help.
64+
accomplish your objectives with this cluster. <ContactUs overEmail={true} />, we are here to help.
6565
</li>
6666
</ul>
6767

@@ -97,7 +97,7 @@ export function ClusterBilling({
9797
</li>
9898
<li>While refunds are not available, we’d be happy to assist you with troubleshooting.</li>
9999
<li>We would love to work with you to sort out more precise details, and to help accomplish your objectives
100-
with this cluster. <ContactUs />, we are here to help.
100+
with this cluster. <ContactUs overEmail={true} />, we are here to help.
101101
</li>
102102
</ul>
103103

src/features/organization/billing/invoices/Invoices.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function Invoices() {
3838
return (
3939
<span>
4040
Your invoices will be shown here once one is available! Want to explore your solution with Harper
41-
more? <ContactUs />, we would love to talk!
41+
more? <ContactUs overEmail={true} />, we would love to talk!
4242
</span>
4343
);
4444
}

0 commit comments

Comments
 (0)