Skip to content

Commit 4820d03

Browse files
committed
[red] Require public GitHub repository links
Signed-off-by: Viwat Vchirawongkwin <viwat.v@chula.ac.th> (cherry picked from commit 47a75f80848f25af7f2e8ea9b5402d1e96a04a91)
1 parent 29d508a commit 4820d03

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

‎tools/web/src/test/site-contract.test.tsx‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import FlashPage, { metadata as flashMetadata } from "@/app/flash/page";
1212
import HomePage, { metadata as homeMetadata } from "@/app/page";
1313
import PrivacyPage, { metadata as privacyMetadata } from "@/app/privacy/page";
1414
import SupportPage, { metadata as supportMetadata } from "@/app/support/page";
15+
import { SiteFooter } from "@/components/site-footer";
1516
import { SiteHeader } from "@/components/site-header";
1617
import { initialFirmwareTargets, navigation, siteConfig } from "@/lib/site";
1718

@@ -140,6 +141,41 @@ describe("public-site contract", () => {
140141
).not.toBeInTheDocument();
141142
});
142143

144+
it("publishes the canonical MIT source repository from the home page and global footer", () => {
145+
const repositoryUrl = "https://github.com/PyBLE-dev/PyBLE";
146+
147+
expect(siteConfig.repositoryUrl).toBe(repositoryUrl);
148+
149+
render(
150+
<>
151+
<HomePage />
152+
<SiteFooter />
153+
</>,
154+
);
155+
156+
const sourceSection = screen.getByRole("region", {
157+
name: "See how PyBLE is built.",
158+
});
159+
expect(
160+
within(sourceSection).getByText(
161+
/tablet app, board-agent firmware, PBLE\/1 protocol, tests, and documentation/i,
162+
),
163+
).toHaveTextContent(/developed in public under the MIT license/i);
164+
165+
const sourceLink = within(sourceSection).getByRole("link", {
166+
name: "Explore PyBLE on GitHub",
167+
});
168+
expect(sourceLink).toHaveAttribute("href", repositoryUrl);
169+
expect(sourceLink).toHaveAttribute("target", "_blank");
170+
expect(sourceLink).toHaveAttribute("rel", "noopener noreferrer");
171+
172+
const footer = screen.getByRole("navigation", { name: "Footer" });
173+
const footerLink = within(footer).getByRole("link", { name: "GitHub" });
174+
expect(footerLink).toHaveAttribute("href", repositoryUrl);
175+
expect(footerLink).toHaveAttribute("target", "_blank");
176+
expect(footerLink).toHaveAttribute("rel", "noopener noreferrer");
177+
});
178+
143179
it("publishes the approved TestFlight invitation as a link and verified local QR code", async () => {
144180
const testFlightUrl = "https://testflight.apple.com/join/yU4e8s6d";
145181

0 commit comments

Comments
 (0)