From 581da69bb81ca1491b4196c4ec1b04263588ae01 Mon Sep 17 00:00:00 2001 From: Adam Zielinski Date: Fri, 12 Apr 2024 00:18:12 +0200 Subject: [PATCH] Unit tests: Restore site-data.spec.ts (#1194) The test was removed in #1192 due to intermittent failures like these: ``` FAIL src/lib/steps/site-data.spec.ts > Blueprint step setSiteOptions() > should set the site option ``` ![CleanShot 2024-04-04 at 13 09 25@2x](https://github.com/WordPress/wordpress-playground/assets/205419/fe68c5ff-80a7-4966-82a8-fbfcc7e9a101) They seem related to #1189, but: * I can't reproduce it locally * The test actually passed in #1189 and only started failing in #1192 * All the other tests pass and the Playground website works so I wonder what's going on there. * The stack trace mentions network activity, but that call shouldn't involve any. It's almost as if the trace was coming from `php-networking.spec.ts`, but those tests actually pass. Is the CI runner just running out of memory? But then it shouldn't be able to allocate the memory segment in the first place. Weird! CC @brandonpayton for insights --- .../src/lib/steps/site-data.spec.ts | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 packages/playground/blueprints/src/lib/steps/site-data.spec.ts diff --git a/packages/playground/blueprints/src/lib/steps/site-data.spec.ts b/packages/playground/blueprints/src/lib/steps/site-data.spec.ts new file mode 100644 index 0000000000..bcabec8a38 --- /dev/null +++ b/packages/playground/blueprints/src/lib/steps/site-data.spec.ts @@ -0,0 +1,37 @@ +import { NodePHP } from '@php-wasm/node'; +import { + RecommendedPHPVersion, + getWordPressModule, +} from '@wp-playground/wordpress'; +import { setSiteOptions } from './site-data'; +import { unzip } from './unzip'; + +describe('Blueprint step setSiteOptions()', () => { + let php: NodePHP; + beforeEach(async () => { + php = await NodePHP.load(RecommendedPHPVersion, { + requestHandler: { + documentRoot: '/wordpress', + }, + }); + await unzip(php, { + zipFile: await getWordPressModule(), + extractToPath: '/wordpress', + }); + }); + + it('should set the site option', async () => { + await setSiteOptions(php, { + options: { + blogname: 'My test site!', + }, + }); + const response = await php.run({ + code: `