test: cover the new content models and stop duplicate terms

Seeding guarded with term_exists(), which reads a cache that is not
always warm during activation and let a second activation insert
gaming-2, literature-2 and silicon-ranch-2. It asks the taxonomy
directly now, by slug and by name.

Fixtures gain projects and tracks, and the suites follow the assets to
their generated derivatives. Also widens the Site Editor poll, which
threw instead of retrying while the editor was still booting.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
chrnxandClaude Opus 5 committed 2026-08-13 19:42:07 -05:00
1 parent df117e67bb
commit cb491adae6
7 files changed
+125 -30

No files matched your search

+7
View File
@@ -42,4 +42,11 @@ test( 'editorial and podcast controls initialize in the real post editor', async
await expect( page.getByLabel( 'Duration', { exact: true } ) ).toBeVisible();
await expect( page.getByLabel( 'Participants (one per line)', { exact: true } ) ).toBeVisible();
await expect( page.getByLabel( 'Canonical episode URL', { exact: true } ) ).toBeVisible();
// Switching topic swaps which per-topic panel is offered.
await openPanel( 'Topic' );
await page.getByRole( 'radio', { name: 'Projects', exact: true } ).check();
await expect( page.getByLabel( 'Episode number', { exact: true } ) ).toBeHidden();
await openPanel( 'Project' );
await expect( page.getByLabel( 'Show in Selected work', { exact: true } ) ).toBeVisible();
} );
+16 -14
View File
@@ -7,7 +7,7 @@ const landings = [
path: '/music/',
root: '.chrnx-music-landing',
atmosphere: '.chrnx-character-stage__collage',
art: 'img[src*="the-no-names-musician-cutout.png"]',
art: 'img[src*="the-no-names-musician-cutout-768.webp"]',
internalHeadings: ':scope > h3, .chrnx-release-card h4',
internalHeadingCount: 4,
next: ':scope > p',
@@ -17,7 +17,7 @@ const landings = [
path: '/podcasts/',
root: '.chrnx-podcast-landing',
atmosphere: '.chrnx-character-stage__frequency',
art: 'img[src*="alter-ego-podcasts.png"]',
art: 'img[src*="alter-ego-podcasts-768.webp"]',
internalHeadings: '.chrnx-podcast-card__title',
internalHeadingCount: 1,
next: ':scope > .wp-block-chrnx-latest-podcast',
@@ -550,24 +550,26 @@ const immutableSurfaces = [
name: 'Projects',
path: '/projects/',
root: '.chrnx-home-projects',
art: 'img[src*="alter-ego-code.png"]',
atmosphereCount: 1,
imageSources: [ 'alter-ego-research.png', 'alter-ego-code.png' ],
headings: [ 'Selected work', 'Expressive Tea', 'Ailed', 'Published research' ],
art: 'img[src*="alter-ego-code-768.webp"]',
atmosphereCount: 2,
imageSources: [
'projects-grunge-1536.webp',
'alter-ego-research-768.webp',
'alter-ego-code-768.webp',
],
// Project names come from chrnx/selected-work: picked projects newest-first,
// then the most recent ones. This is the seeded order, not a frozen string.
headings: [ 'Selected work', 'Ailed', 'Expressive Tea', 'Published research' ],
paragraphs: [],
contentText: 'Selected work Expressive Tea Ailed Published research',
contentText: 'Selected work Ailed Expressive Tea Published research',
},
{
name: 'About',
path: '/about/',
root: '.chrnx-about',
art: 'img[src*="alter-ego-life.png"]',
atmosphereCount: 0,
imageSources: [
'alter-ego-life.png',
'alter-ego-literature.png',
'alter-ego-gaming-half-body.png',
],
art: 'img[src*="alter-ego-life-768.webp"]',
atmosphereCount: 1,
imageSources: [ 'about-grunge-1536.webp', 'alter-ego-life-768.webp' ],
headings: [ 'About', 'Beyond the work' ],
paragraphs: [
'I work as Lead Developer @Expressive Tea, building full-stack software with JavaScript and Python. I am also an independent researcher exploring emotion modeling and game AI; my practice includes open source work and amateur data science.',
+18 -10
View File
@@ -6,8 +6,8 @@ const patterns = [
patternTitle: 'Music landing',
pageSlug: 'music',
patternSlug: 'chrnx/music-landing',
atmosphereAsset: 'the-no-names-collage.jpeg',
artAsset: 'the-no-names-musician-cutout.png',
atmosphereAsset: 'the-no-names-collage-768.webp',
artAsset: 'the-no-names-musician-cutout-768.webp',
contentCopy: 'The No Names es una banda activa',
supportingCopy: 'El proceso usa generative AI',
},
@@ -16,8 +16,8 @@ const patterns = [
patternTitle: 'Podcast landing',
pageSlug: 'podcasts',
patternSlug: 'chrnx/podcast-landing',
atmosphereAsset: 'podcast-frequency-grunge.png',
artAsset: 'alter-ego-podcasts.png',
atmosphereAsset: 'podcast-frequency-grunge-1536.webp',
artAsset: 'alter-ego-podcasts-768.webp',
contentCopy: 'Conversations about the work behind software, research, music, and games.',
supportingCopy: '<!-- wp:chrnx/latest-podcast /-->',
},
@@ -55,12 +55,15 @@ async function closeWelcomeGuide( page ) {
}
async function waitForEditor( page ) {
// The Site Editor boots slower than the default 5s poll under load.
await expect
.poll( () =>
page.evaluate( () => {
const editor = window.wp?.data?.select( 'core/block-editor' );
return typeof editor?.getBlocks === 'function' && editor.getBlocks().length > 0;
} ),
.poll(
() =>
page.evaluate( () => {
const editor = window.wp?.data?.select( 'core/block-editor' );
return typeof editor?.getBlocks === 'function' && editor.getBlocks().length > 0;
} ),
{ timeout: 20_000 },
)
.toBe( true );
}
@@ -70,7 +73,12 @@ async function waitForPatternEditorState( page ) {
.poll(
() =>
page.evaluate( () => {
const store = window.wp.data.select( 'core/block-editor' );
// The editor may still be booting on the first poll; returning an
// empty list retries instead of throwing out of expect.poll.
const store = window.wp?.data?.select( 'core/block-editor' );
if ( typeof store?.getBlocks !== 'function' ) {
return [];
}
const flatten = ( blocks ) =>
blocks.flatMap( ( block ) => [ block, ...flatten( block.innerBlocks || [] ) ] );
const all = flatten( store.getBlocks() );
+2 -2
View File
@@ -18,7 +18,7 @@
"slug": "projects",
"title": "Projects",
"status": "publish",
"content": "<!-- wp:paragraph {\"className\":\"chrnx-page-kicker\"} --><p class=\"chrnx-page-kicker\">Software · investigación · sistemas expresivos</p><!-- /wp:paragraph --><!-- wp:pattern {\"slug\":\"chrnx/home-projects\"} /--><!-- wp:pattern {\"slug\":\"chrnx/project-detail\"} /-->"
"content": "<!-- wp:paragraph {\"className\":\"chrnx-page-kicker\"} --><p class=\"chrnx-page-kicker\">Software · investigación · sistemas expresivos</p><!-- /wp:paragraph --><!-- wp:pattern {\"slug\":\"chrnx/home-projects\"} /--><!-- wp:chrnx/journal-stream {\"topic\":\"projects\"} /-->"
},
{
"fixtureKey": "page-music",
@@ -46,6 +46,6 @@
"slug": "subscribe",
"title": "Subscribe",
"status": "publish",
"content": "<!-- wp:heading {\"level\":2} --><h2 class=\"wp-block-heading\">Stay close to the work</h2><!-- /wp:heading --><!-- wp:paragraph --><p>New notes, experiments, music, and conversations. The final subscription provider will be connected before launch.</p><!-- /wp:paragraph -->"
"content": "<!-- wp:heading {\"level\":2} --><h2 class=\"wp-block-heading\">Stay close to the work</h2><!-- /wp:heading --><!-- wp:paragraph --><p>New notes, experiments, music, and conversations.</p><!-- /wp:paragraph --><!-- wp:chrnx/subscribe-form /-->"
}
]
+62
View File
@@ -9,6 +9,35 @@
"featured": true,
"fixtureState": "unbroken-code"
},
{
"fixtureKey": "post-project-expressive-tea",
"title": "Expressive Tea",
"slug": "expressive-tea",
"excerpt": "Full-stack product work in JavaScript and Python, built with a small team and a long memory.",
"content": "<!-- wp:paragraph --><p>Lead development on a full-stack product built with JavaScript and Python, where the interesting constraints are organizational as often as technical.</p><!-- /wp:paragraph -->",
"topic": "projects",
"language": "en",
"projectFeatured": true
},
{
"fixtureKey": "post-project-ailed",
"title": "Ailed",
"slug": "ailed",
"excerpt": "An expressive agent that models hesitation instead of resolving it away.",
"content": "<!-- wp:paragraph --><p>An experiment in emotion modeling for game AI: the agent is allowed to be uncertain, and that uncertainty is part of its behavior rather than a defect.</p><!-- /wp:paragraph -->",
"topic": "projects",
"language": "en",
"projectFeatured": true
},
{
"fixtureKey": "post-project-published-research",
"title": "Published research",
"slug": "published-research",
"excerpt": "Independent research on emotion modeling and expressive systems.",
"content": "<!-- wp:paragraph --><p>Independent research published on arXiv, covering emotion modeling and the design of systems that can express internal state.</p><!-- /wp:paragraph -->",
"topic": "projects",
"language": "en"
},
{
"fixtureKey": "post-research-primary",
"title": "What game AI can learn from the uncomfortable space between intention and action",
@@ -47,6 +76,39 @@
"language": "es",
"fixtureState": "missing-media"
},
{
"fixtureKey": "post-track-uno",
"title": "La primera que se rompió",
"slug": "la-primera-que-se-rompio",
"excerpt": "Fixture local de canción: letra y notas de proceso sin publicar material real.",
"content": "<!-- wp:heading {\"level\":2} --><h2 class=\"wp-block-heading\">Letra</h2><!-- /wp:heading --><!-- wp:paragraph --><p>Este contenido existe únicamente como fixture local del tema.</p><!-- /wp:paragraph --><!-- wp:heading {\"level\":2} --><h2 class=\"wp-block-heading\">Por qué existe</h2><!-- /wp:heading --><!-- wp:paragraph --><p>Nota de proceso de ejemplo para validar la plantilla de canción.</p><!-- /wp:paragraph -->",
"topic": "music",
"language": "es",
"release": "el-hermoso-caos",
"trackNumber": 1
},
{
"fixtureKey": "post-track-dos",
"title": "Cuarto sin ventanas",
"slug": "cuarto-sin-ventanas",
"excerpt": "Fixture local de canción para validar el orden de la lista de pistas.",
"content": "<!-- wp:heading {\"level\":2} --><h2 class=\"wp-block-heading\">Letra</h2><!-- /wp:heading --><!-- wp:paragraph --><p>Este contenido existe únicamente como fixture local del tema.</p><!-- /wp:paragraph -->",
"topic": "music",
"language": "es",
"release": "el-hermoso-caos",
"trackNumber": 2
},
{
"fixtureKey": "post-track-tres",
"title": "Jerga rota",
"slug": "jerga-rota",
"excerpt": "Fixture local de canción asignada a otro disco.",
"content": "<!-- wp:heading {\"level\":2} --><h2 class=\"wp-block-heading\">Letra</h2><!-- /wp:heading --><!-- wp:paragraph --><p>Este contenido existe únicamente como fixture local del tema.</p><!-- /wp:paragraph -->",
"topic": "music",
"language": "es",
"release": "aqui-se-rompio-una-jerga",
"trackNumber": 1
},
{
"fixtureKey": "post-podcast-episode",
"title": "Silicon Ranch: conversaciones sin diapositivas",
+6 -3
View File
@@ -29,7 +29,8 @@ class ResponsiveMediaTest extends WP_UnitTestCase {
$this->assertStringContainsString( 'podcast-frequency-grunge-768.webp 768w', $markup );
$this->assertStringContainsString( 'podcast-frequency-grunge-1536.webp 1536w', $markup );
$this->assertStringContainsString( 'sizes="(max-width: 780px) 100vw, 1200px"', $markup );
$this->assertStringContainsString( 'podcast-frequency-grunge.png', $markup );
$this->assertStringContainsString( 'src="http://', $markup );
$this->assertDoesNotMatchRegularExpression( '#src="[^"]*/assets/images/podcast-frequency-grunge\.png"#', $markup );
$this->assertStringContainsString( 'class="chrnx-character-stage__frequency"', $markup );
$this->assertStringContainsString( 'width="1536"', $markup );
$this->assertStringContainsString( 'height="1024"', $markup );
@@ -43,14 +44,16 @@ class ResponsiveMediaTest extends WP_UnitTestCase {
$this->assertSame( '', chrnx_get_atmosphere_markup( '../../private', 'unsafe class' ) );
}
/** Approved topic portraits render a compact picture element with a PNG fallback. */
/** Approved topic portraits render a compact picture element with a WebP fallback. */
public function test_topic_portrait_picture_markup_has_modern_sources_and_dimensions() {
$markup = chrnx_get_topic_portrait_markup( 'code', 'Code workshop portrait', 'chrnx-section-portrait' );
$this->assertStringContainsString( '<picture', $markup );
$this->assertStringContainsString( 'type="image/avif"', $markup );
$this->assertStringContainsString( 'type="image/webp"', $markup );
$this->assertStringContainsString( 'alter-ego-code.png', $markup );
// The fallback is a generated derivative, never the design master.
$this->assertStringContainsString( 'generated/alter-ego-code-768.webp', $markup );
$this->assertDoesNotMatchRegularExpression( '#src="[^"]*/assets/images/alter-ego-code\.png"#', $markup );
$this->assertStringContainsString( 'width="1122"', $markup );
$this->assertStringContainsString( 'height="1402"', $markup );
$this->assertStringContainsString( 'loading="lazy"', $markup );