Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcdea8c6

Browse files
f0sselclaude
andcommitted
test: add registry link tests for template pages
Add simple tests to verify the Coder registry links are presentand properly configured on both the starter templates page andtemplate editor:- Tests link text, href, target, and rel attributes- Uses existing test patterns with MSW and React Testing Library- Verifies external link behavior and accessibility🤖 Generated with [Claude Code](https://claude.ai/code)Co-Authored-By: Claude <noreply@anthropic.com>
1 parentf5d1e59 commitcdea8c6

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

‎site/src/pages/CreateTemplateGalleryPage/CreateTemplateGalleryPage.test.tsx‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,39 @@ test("displays the scratch template", async () => {
5151
screen.getByText(MockTemplateExample2.name);
5252
expect(screen.queryByText("Scratch")).toBeInTheDocument();
5353
});
54+
55+
test("displays registry link in page header",async()=>{
56+
server.use(
57+
http.get("api/v2/templates/examples",()=>{
58+
returnHttpResponse.json([MockTemplateExample]);
59+
}),
60+
);
61+
62+
render(
63+
<AppProviders>
64+
<RouterProvider
65+
router={createMemoryRouter(
66+
[
67+
{
68+
element:<RequireAuth/>,
69+
children:[
70+
{
71+
path:"/starter-templates",
72+
element:<CreateTemplateGalleryPage/>,
73+
},
74+
],
75+
},
76+
],
77+
{initialEntries:["/starter-templates"]},
78+
)}
79+
/>
80+
</AppProviders>,
81+
);
82+
83+
constregistryLink=awaitscreen.findByRole("link",{
84+
name:/browsethecoderregistry/i,
85+
});
86+
expect(registryLink).toHaveAttribute("href","https://registry.coder.com");
87+
expect(registryLink).toHaveAttribute("target","_blank");
88+
expect(registryLink).toHaveAttribute("rel","noopener noreferrer");
89+
});

‎site/src/pages/TemplateVersionEditorPage/TemplateVersionEditorPage.test.tsx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,18 @@ describe.each([
334334
},
335335
);
336336

337+
test("displays registry link in template editor topbar",async()=>{
338+
renderEditorPage();
339+
awaitwaitForLoaderToBeRemoved();
340+
341+
constregistryLink=screen.getByRole("link",{
342+
name:/browsethecoderregistry/i,
343+
});
344+
expect(registryLink).toHaveAttribute("href","https://registry.coder.com");
345+
expect(registryLink).toHaveAttribute("target","_blank");
346+
expect(registryLink).toHaveAttribute("rel","noopener noreferrer");
347+
});
348+
337349
test("display pending badge and update it to running when status changes",async()=>{
338350
constMockPendingTemplateVersion={
339351
...MockTemplateVersion,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp