Skip to content

Commit

Permalink
Fix a couple of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonpayton committed Jun 24, 2024
1 parent 22a000d commit 254b33f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/php-wasm/node/src/test/php-request-handler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ describe.each(SupportedPHPVersions)(
(phpVersion) => {
let php: PHP;
let handler: PHPRequestHandler;
// TODO: Improve name
let testIsKnownRemoteAsset: (_: string) => boolean = () => false;
beforeEach(async () => {
handler = new PHPRequestHandler({
documentRoot: '/',
phpFactory: async () =>
new PHP(await loadNodeRuntime(phpVersion)),
maxPhpInstances: 1,
isKnownRemoteAssetPath: (wpRelativePath: string) => {
return testIsKnownRemoteAsset(wpRelativePath);
},
});
php = await handler.getPrimaryPhp();
});
Expand Down Expand Up @@ -124,7 +129,7 @@ describe.each(SupportedPHPVersions)(
});

it('should yield x-file-type=static when a static file is not found and is listed as a remote asset', async () => {
handler.addRemoteAssetPaths(['index.html']);
testIsKnownRemoteAsset = (p: string) => p === '/index.html';
const response = await handler.request({
url: '/index.html',
});
Expand All @@ -140,6 +145,7 @@ describe.each(SupportedPHPVersions)(
});

it('should not yield x-file-type=static when a static file is not found and is not listed as a remote asset', async () => {
testIsKnownRemoteAsset = () => false;
const response = await handler.request({
url: '/index.html',
});
Expand Down

0 comments on commit 254b33f

Please sign in to comment.