Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: burst cache in e2e tests #2154

Merged
merged 1 commit into from
Oct 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions tests/e2e/e2e.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const REPOSITORY_DATA = {
forkCount: 0,
starCount: 1,
};
const CACHE_BURST_STRING = `v=${new Date().getTime()}`;

describe("Fetch Cards", () => {
let VERCEL_PREVIEW_URL;
Expand All @@ -104,7 +105,7 @@ describe("Fetch Cards", () => {

// Get the Vercel preview stats card response.
const serverStatsSvg = await axios.get(
`${VERCEL_PREVIEW_URL}/api?username=${USER}`,
`${VERCEL_PREVIEW_URL}/api?username=${USER}&${CACHE_BURST_STRING}`,
);

// Check if stats card from deployment matches the stats card from local.
Expand All @@ -115,16 +116,21 @@ describe("Fetch Cards", () => {
expect(VERCEL_PREVIEW_URL).toBeDefined();

// Check if the Vercel preview instance language card function is up and running.
console.log(
`${VERCEL_PREVIEW_URL}/api/top-langs/?username=${USER}&${CACHE_BURST_STRING}`,
);
await expect(
axios.get(`${VERCEL_PREVIEW_URL}/api/top-langs/?username=${USER}`),
axios.get(
`${VERCEL_PREVIEW_URL}/api/top-langs/?username=${USER}&${CACHE_BURST_STRING}`,
),
).resolves.not.toThrow();

// Get local language card.
const localLanguageCardSVG = renderTopLanguages(LANGS_DATA);

// Get the Vercel preview language card response.
const severLanguageSVG = await axios.get(
`${VERCEL_PREVIEW_URL}/api/top-langs/?username=${USER}`,
`${VERCEL_PREVIEW_URL}/api/top-langs/?username=${USER}&${CACHE_BURST_STRING}`,
);

// Check if language card from deployment matches the local language card.
Expand All @@ -144,7 +150,7 @@ describe("Fetch Cards", () => {

// Get the Vercel preview WakaTime card response.
const serverWakaTimeSvg = await axios.get(
`${VERCEL_PREVIEW_URL}/api/wakatime?username=${USER}`,
`${VERCEL_PREVIEW_URL}/api/wakatime?username=${USER}&${CACHE_BURST_STRING}`,
);

// Check if WakaTime card from deployment matches the local WakaTime card.
Expand All @@ -156,15 +162,17 @@ describe("Fetch Cards", () => {

// Check if the Vercel preview instance Repo function is up and running.
await expect(
axios.get(`${VERCEL_PREVIEW_URL}/api/pin/?username=${USER}&repo=${REPO}`),
axios.get(
`${VERCEL_PREVIEW_URL}/api/pin/?username=${USER}&repo=${REPO}&${CACHE_BURST_STRING}`,
),
).resolves.not.toThrow();

// Get local repo card.
const localRepoCardSVG = renderRepoCard(REPOSITORY_DATA);

// Get the Vercel preview repo card response.
const serverRepoSvg = await axios.get(
`${VERCEL_PREVIEW_URL}/api/pin/?username=${USER}&repo=${REPO}`,
`${VERCEL_PREVIEW_URL}/api/pin/?username=${USER}&repo=${REPO}&${CACHE_BURST_STRING}`,
);

// Check if Repo card from deployment matches the local Repo card.
Expand Down