repo-view.test.js
1,200 bytes
| 1 | import { afterEach, describe, expect, it } from "vitest"; |
|---|---|
| 2 | import { createShare, makeHarness } from "./helpers.js"; |
| 3 | |
| 4 | describe("repository view", () => { |
| 5 | let harness; |
| 6 | afterEach(() => harness.close()); |
| 7 | |
| 8 | it("shows a GitHub-style code overview with a rendered README and commit tab", async () => { |
| 9 | harness = makeHarness(); |
| 10 | const { id } = await createShare(harness); |
| 11 | const page = await harness.agent.get(`/s/${id}/repositories/101`).expect(200); |
| 12 | expect(page.text).toContain("README.md"); |
| 13 | expect(page.text).toContain("src"); |
| 14 | expect(page.text).toContain("Finish atlas viewer"); |
| 15 | expect(page.text).toContain("<h1>atlas</h1>"); |
| 16 | expect(page.text).toContain("<h2>Highlights</h2>"); |
| 17 | expect(page.text).toContain(`/s/${id}/repositories/101?file=docs%2Fguide.md`); |
| 18 | expect(page.text).not.toContain("<script>"); |
| 19 | expect(page.text).toContain("?tab=commits"); |
| 20 | expect(page.text).toContain('class="repo-icon repo-icon-branch" width="14" height="14"'); |
| 21 | const commits = await harness.agent.get(`/s/${id}/repositories/101?tab=commits`).expect(200); |
| 22 | expect(commits.text).toContain("Finish atlas viewer"); |
| 23 | expect(commits.text).toContain("Start atlas"); |
| 24 | }); |
| 25 | }); |
| 26 | |