Skip to content

Commit e043548

Browse files
committed
[e2e magazine] Fix category tests
The latest fixture model update (adding default category to articles) was breaking the category tests, as it tried to read the output file, which doesn't exist. This is fix for that. Also some stupid ai code elimination
1 parent 8f62dcb commit e043548

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/e2e-tests/magazine/category.test.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ test('E2E Magazine - Category Pages', async t => {
102102
categoryPath,
103103
parentPath = ''
104104
) => {
105+
if (category.isDefaultCategory) {
106+
return
107+
}
108+
105109
const categoryIndexPath = join(
106110
rootDirectory,
107111
exportDirectory,
@@ -158,9 +162,9 @@ test('E2E Magazine - Category Pages', async t => {
158162
const postLinks = $('[data-post-link]').toArray()
159163
const categoryLinks = $('[data-category-link]').toArray()
160164

161-
if (usedFacets.size !== 0) {
165+
if (usedFacets.size) {
162166
t.ok(
163-
facetBrowseLink.length !== 0,
167+
facetBrowseLink.length,
164168
`${collection.slug}/${categoryPath} has browse facets link`
165169
)
166170
}
@@ -415,7 +419,7 @@ test('E2E Magazine - Category Pages', async t => {
415419
}
416420

417421
for (const collection of FIXTURE_CONTENT_MODEL.collections) {
418-
if (!collection.categories || collection.categories.length === 0) {
422+
if (!collection.categories || !collection.categories.length) {
419423
continue
420424
}
421425

@@ -427,7 +431,7 @@ test('E2E Magazine - Category Pages', async t => {
427431

428432
t.test('Verify category facet browse pages', async t => {
429433
const testBrowsePage = async (collection, category, categoryPath, usedFacets) => {
430-
if (usedFacets.size === 0) {
434+
if (category.isDefaultCategory || !usedFacets.size) {
431435
return
432436
}
433437

@@ -485,7 +489,7 @@ test('E2E Magazine - Category Pages', async t => {
485489
}
486490

487491
for (const collection of FIXTURE_CONTENT_MODEL.collections) {
488-
if (!collection.categories || collection.categories.length === 0) {
492+
if (!collection.categories || !collection.categories.length) {
489493
continue
490494
}
491495

@@ -497,7 +501,7 @@ test('E2E Magazine - Category Pages', async t => {
497501

498502
t.test('Verify category facetName pages', async t => {
499503
const testFacetNamePage = async (collection, category, categoryPath, usedFacets) => {
500-
if (usedFacets.size === 0) {
504+
if (category.isDefaultCategory || !usedFacets.size) {
501505
return
502506
}
503507

@@ -566,7 +570,7 @@ test('E2E Magazine - Category Pages', async t => {
566570
}
567571

568572
for (const collection of FIXTURE_CONTENT_MODEL.collections) {
569-
if (!collection.categories || collection.categories.length === 0) {
573+
if (!collection.categories || !collection.categories.length) {
570574
continue
571575
}
572576

@@ -578,7 +582,7 @@ test('E2E Magazine - Category Pages', async t => {
578582

579583
t.test('Verify category facetValue pages', async t => {
580584
const testFacetValuePage = async (collection, category, categoryPath, usedFacets) => {
581-
if (usedFacets.size === 0) {
585+
if (category.isDefaultCategory || !usedFacets.size) {
582586
return
583587
}
584588

@@ -667,7 +671,7 @@ test('E2E Magazine - Category Pages', async t => {
667671
}
668672

669673
for (const collection of FIXTURE_CONTENT_MODEL.collections) {
670-
if (!collection.categories || collection.categories.length === 0) {
674+
if (!collection.categories || !collection.categories.length) {
671675
continue
672676
}
673677

@@ -679,7 +683,7 @@ test('E2E Magazine - Category Pages', async t => {
679683

680684
t.test('Verify no category facet pages for categories with zero used facets', async t => {
681685
const testNoFacetPages = async (collection, category, categoryPath, usedFacets) => {
682-
if (usedFacets.size !== 0) {
686+
if (usedFacets.size) {
683687
return
684688
}
685689

@@ -711,7 +715,7 @@ test('E2E Magazine - Category Pages', async t => {
711715
}
712716

713717
for (const collection of FIXTURE_CONTENT_MODEL.collections) {
714-
if (!collection.categories || collection.categories.length === 0) {
718+
if (!collection.categories || !collection.categories.length) {
715719
continue
716720
}
717721

0 commit comments

Comments
 (0)