feat: add route-backed project case studies
This commit is contained in:
@@ -61,6 +61,28 @@ test('the standalone server renders both locales and optimizes local images', as
|
||||
assert.match(persianHtml, /<html[^>]*lang="fa"[^>]*dir="rtl"/i);
|
||||
assert.match(persianHtml, /سلام، من امیرحسین خلیلی هستم/);
|
||||
|
||||
const projectIds = [
|
||||
'qlockify',
|
||||
'guilan-ace',
|
||||
'zarinpal',
|
||||
'iran-implant',
|
||||
'interanet-solutions',
|
||||
'postgresql-job-queue',
|
||||
'subsource',
|
||||
];
|
||||
const projectRoutes = projectIds.flatMap((id) => [`/projects/${id}`, `/fa/projects/${id}`]);
|
||||
const projectResponses = await Promise.all(projectRoutes.map((route) => fetch(`${origin}${route}`)));
|
||||
for (const response of projectResponses) assert.equal(response.status, 200);
|
||||
const projectHtml = await Promise.all(projectResponses.map((response) => response.text()));
|
||||
for (let index = 0; index < projectHtml.length; index += 1) {
|
||||
assert.match(projectHtml[index], /<dialog[^>]*aria-labelledby="case-study-title"/i);
|
||||
assert.match(projectHtml[index], /id="case-study-title"/i);
|
||||
assert.match(projectHtml[index], /Qlockify|Guilan|زرین|Implant|ایمپلنت|Interanet|اینترانت|PostgreSQL|Subsource|سابسورس/i);
|
||||
assert.match(projectHtml[index], index % 2 === 0 ? /<html[^>]*dir="ltr"/i : /<html[^>]*dir="rtl"/i);
|
||||
}
|
||||
assert.equal((await fetch(`${origin}/projects/not-a-project`)).status, 404);
|
||||
assert.equal((await fetch(`${origin}/fa/projects/not-a-project`)).status, 404);
|
||||
|
||||
const staticAsset = englishHtml.match(/(?:src|href)="(\/_next\/static\/[^"?#]+)/)?.[1];
|
||||
assert.ok(staticAsset, 'expected a built static asset');
|
||||
assert.equal((await fetch(`${origin}${staticAsset}`)).status, 200);
|
||||
|
||||
Reference in New Issue
Block a user