Skip to content

Commit 6c697e3

Browse files
committed
refactor: rewrite code for clarity
1 parent 97e0c8d commit 6c697e3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

site/src/hooks/useClipboard.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ function makeMockClipboard(isSecureContext: boolean): MockClipboard {
6666
}
6767

6868
function renderUseClipboard(textToCopy: string) {
69-
type Props = Readonly<{ textToCopy: string }>;
70-
return renderHook<UseClipboardResult, Props>(
71-
({ textToCopy }) => useClipboard(textToCopy),
72-
{ initialProps: { textToCopy } },
69+
return renderHook<UseClipboardResult, { hookText: string }>(
70+
({ hookText }) => useClipboard(hookText),
71+
{ initialProps: { hookText: textToCopy } },
7372
);
7473
}
7574

@@ -128,6 +127,9 @@ function scheduleTests(isHttps: boolean) {
128127
expect(clipboardText).toEqual(textToCheck);
129128
};
130129

130+
/**
131+
* Start of test cases
132+
*/
131133
it("Copies the current text to the user's clipboard", async () => {
132134
const hookText = "dogs";
133135
const { result } = renderUseClipboard(hookText);

0 commit comments

Comments
 (0)