e2e.test.js
1,148 bytes
| 1 | import request from "supertest"; |
|---|---|
| 2 | import { afterEach, describe, expect, it } from "vitest"; |
| 3 | import { createShare, makeHarness } from "./helpers.js"; |
| 4 | |
| 5 | describe("end to end owner verification", () => { |
| 6 | let harness; |
| 7 | afterEach(() => harness.close()); |
| 8 | |
| 9 | it("shows exactly all selected projects and all of their commits without viewer login", async () => { |
| 10 | harness = makeHarness(); |
| 11 | const { id, response } = await createShare(harness, [101, 202]); |
| 12 | expect(response.text).toContain("Review snapshot before sharing"); |
| 13 | expect(response.text).toContain("atlas"); |
| 14 | expect(response.text).toContain("ledger"); |
| 15 | const publicClient = request(harness.app); |
| 16 | const profile = await publicClient.get(`/s/${id}`).expect(200); |
| 17 | expect(profile.text).toContain("atlas"); |
| 18 | expect(profile.text).toContain("ledger"); |
| 19 | for (const repo of [{ id: 101, name: "atlas" }, { id: 202, name: "ledger" }]) { |
| 20 | const page = await publicClient.get(`/s/${id}/repositories/${repo.id}?tab=commits`).expect(200); |
| 21 | expect(page.text).toContain(`Finish ${repo.name} viewer`); |
| 22 | expect(page.text).toContain(`Start ${repo.name}`); |
| 23 | } |
| 24 | }); |
| 25 | }); |
| 26 | |