releases.test.js
2,291 bytes
| 1 | import { afterEach, describe, expect, it } from "vitest"; |
|---|---|
| 2 | import { createShare, makeHarness } from "./helpers.js"; |
| 3 | |
| 4 | describe("releases and repository metadata", () => { |
| 5 | let harness; |
| 6 | afterEach(() => harness.close()); |
| 7 | |
| 8 | it("shows frozen release lists, notes, tag navigation, and asset metadata", async () => { |
| 9 | harness = makeHarness(); |
| 10 | const { id } = await createShare(harness); |
| 11 | |
| 12 | const list = await harness.agent.get(`/s/${id}/repositories/101?tab=releases`).expect(200); |
| 13 | expect(list.text).toContain("atlas v1.0.0"); |
| 14 | expect(list.text).toContain("Latest"); |
| 15 | expect(list.text).toContain("?release=1011"); |
| 16 | |
| 17 | const detail = await harness.agent.get(`/s/${id}/repositories/101?release=1011`).expect(200); |
| 18 | expect(detail.text).toContain("<h2>Highlights</h2>"); |
| 19 | expect(detail.text).toContain("atlas-v1.0.0.zip"); |
| 20 | expect(detail.text).toContain("2,048 bytes"); |
| 21 | expect(detail.text).toContain("not downloadable from this read-only snapshot"); |
| 22 | expect(detail.text).toContain("?ref=v1.0.0&refType=tag"); |
| 23 | expect(detail.text).not.toContain("download="); |
| 24 | }); |
| 25 | |
| 26 | it("shows topics, license, language breakdown, and repository statistics", async () => { |
| 27 | harness = makeHarness(); |
| 28 | const { id } = await createShare(harness); |
| 29 | const page = await harness.agent.get(`/s/${id}/repositories/101`).expect(200); |
| 30 | |
| 31 | expect(page.text).toContain("developer-tools"); |
| 32 | expect(page.text).toContain("MIT"); |
| 33 | expect(page.text).toContain("<strong>12</strong> stars"); |
| 34 | expect(page.text).toContain("JavaScript"); |
| 35 | expect(page.text).toContain("70%"); |
| 36 | expect(page.text).toContain("https://atlas.test"); |
| 37 | }); |
| 38 | |
| 39 | it("finds release notes and assets through snapshot search", async () => { |
| 40 | harness = makeHarness(); |
| 41 | const { id } = await createShare(harness); |
| 42 | const page = await harness.agent |
| 43 | .get(`/s/${id}/search?q=Frozen+release+notes&type=releases`) |
| 44 | .expect(200); |
| 45 | expect(page.text).toContain("atlas v1.0.0"); |
| 46 | expect(page.text).toContain(`repositories/101?release=1011`); |
| 47 | }); |
| 48 | |
| 49 | it("rejects release identifiers outside the snapshot", async () => { |
| 50 | harness = makeHarness(); |
| 51 | const { id } = await createShare(harness); |
| 52 | await harness.agent.get(`/s/${id}/repositories/101?release=999`).expect(404); |
| 53 | }); |
| 54 | }); |
| 55 | |