|
| 1 | +/** |
| 2 | + * @file Contains end-to-end tests for the vercel preview instance. |
| 3 | + */ |
| 4 | +import { describe } from "@jest/globals"; |
| 5 | +import axios from "axios"; |
| 6 | + |
| 7 | +describe("Fetch Cards", () => { |
| 8 | + let VERCEL_PREVIEW_URL; |
| 9 | + |
| 10 | + beforeAll(() => { |
| 11 | + VERCEL_PREVIEW_URL = process.env.VERCEL_URL; |
| 12 | + }); |
| 13 | + |
| 14 | + test("retrieve stats card", async () => { |
| 15 | + expect(VERCEL_PREVIEW_URL).toBeDefined(); |
| 16 | + await expect( |
| 17 | + axios.get(`${VERCEL_PREVIEW_URL}/api?username=anuraghazra`), |
| 18 | + ).resolves.not.toThrow(); |
| 19 | + }); |
| 20 | + |
| 21 | + test("retrieve language card", async () => { |
| 22 | + expect(VERCEL_PREVIEW_URL).toBeDefined(); |
| 23 | + await expect( |
| 24 | + axios.get(`${VERCEL_PREVIEW_URL}/api/top-langs/?username=anuraghazra`), |
| 25 | + ).resolves.not.toThrow(); |
| 26 | + }); |
| 27 | + |
| 28 | + test("retrieve WakaTime card", async () => { |
| 29 | + expect(VERCEL_PREVIEW_URL).toBeDefined(); |
| 30 | + await expect( |
| 31 | + axios.get(`${VERCEL_PREVIEW_URL}/api/wakatime?username=willianrod`), |
| 32 | + ).resolves.not.toThrow(); |
| 33 | + }); |
| 34 | + |
| 35 | + test("retrieve repo card", async () => { |
| 36 | + expect(VERCEL_PREVIEW_URL).toBeDefined(); |
| 37 | + await expect( |
| 38 | + axios.get( |
| 39 | + `${VERCEL_PREVIEW_URL}/api/pin/?username=anuraghazra&repo=github-readme-stats`, |
| 40 | + ), |
| 41 | + ).resolves.not.toThrow(); |
| 42 | + }); |
| 43 | +}); |
0 commit comments