test: burst cache in e2e tests (#2154)

This commit is contained in:
Rick Staa 2022-10-07 20:01:01 +02:00 committed by GitHub
parent 39535db38c
commit bd9865d5a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
@ -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.
@ -115,8 +116,13 @@ 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.
@ -124,7 +130,7 @@ describe("Fetch Cards", () => {
// 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.
@ -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.
@ -156,7 +162,9 @@ 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.
@ -164,7 +172,7 @@ describe("Fetch Cards", () => {
// 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.