Skip to content

Commit

Permalink
Added test for ** path globs
Browse files Browse the repository at this point in the history
  • Loading branch information
dionjwa committed Nov 27, 2024
1 parent 0600f85 commit d7a8587
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function MetaframePage(props: PageProps<VersionsProps>) {
<h2>Metapage test: {props.data.testname}</h2>
<br/>
<a href="https://app.metapage.io/dion/metapage-npm-library-globs-test-6b2482bed7664c5bb91777bdd121f283?view=default">Source metapage</a>

<br/>
<br/>
<p>Choose version:</p>
<br/>
Expand Down
2 changes: 1 addition & 1 deletion app/worker/src/routes/test/metapage/globs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function MetaframePage(props: PageProps<VersionsProps>) {
<h2>Metapage test: {props.data.testname}</h2>
<br/>
<a href="https://app.metapage.io/dion/metapage-npm-library-globs-test-6b2482bed7664c5bb91777bdd121f283?view=default">Source metapage</a>

<br/>
<br/>
<p>Choose version:</p>
<br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default function MetaframePage(props: PageProps<VersionProps>) {
</Head>
<main>
<p>Metapage test {testname} @ version: {displayVersion}</p>
<a href="https://app.metapage.io/dion/metapages-module-test-io-pipe-names-6a97801b3eed4b3d9d6f5d24b508f324?view=default">Source metapage</a>
<div id='status'>status</div>
<div id='body'></div>
<script type="module" src={`/metapage-test-${testname}.js`}></script>
Expand Down
5 changes: 5 additions & 0 deletions app/worker/src/routes/test/metapage/io-pipe-names/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ export default function MetaframePage(props: PageProps<VersionsProps>) {
</Head>
<main>
<h2>Metapage test: {props.data.testname}</h2>
<br/>
<a href="https://app.metapage.io/dion/metapages-module-test-io-pipe-names-6a97801b3eed4b3d9d6f5d24b508f324?view=default">Source metapage</a>
<br/>
<br/>
<p>Choose version:</p>
<br/>
{
props.data.versions.map((version) => (
<>
Expand Down
14 changes: 7 additions & 7 deletions app/worker/src/static/metapage-test-io-pipe-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const TestMetapageUrl = `${SourceMetapage}/metapage.json`;
// to make it easier to test all versions against all
const { compareVersions } = window.compareVersions
const url = new URL(window.location.href);
console.log(`url: ${url}`);
// console.log(`url: ${url}`);
const urlPathElements = url.pathname.split("/").filter((e) =>
e !== ""
);
Expand All @@ -18,7 +18,7 @@ const importURl = `${
version.split("-")[0]
}`;

console.log('importURl', importURl);
// console.log('importURl', importURl);
const { Metapage } = await import(importURl);

let debug = ["debug", "mp_debug"].reduce((exists, flag) => {
Expand Down Expand Up @@ -107,17 +107,17 @@ TESTS = [
let disposeListener;
const onStateChange = (e) => {
const outputs = metapage.getState().metaframes.outputs;
// console.log('metapage state', metapage.getState().metaframes);

const metaframeIds = metapage.metaframeIds();

const success = metaframeIds.every((id) => outputs[id]?.success);
// console.log('success', success);
const filterMetaframesThatOutputSuccess = (id) => {
return !(metapage.getDefinition().metaframes[id].url.startsWith("https://app.metapage.io/fs") || metapage.getDefinition().metaframes[id].url.startsWith("https://container.mtfm.io"));
}

const success = metaframeIds.filter(filterMetaframesThatOutputSuccess).every((id) => outputs[id]?.success);
if (success) {
disposeListener();
resolve(true);
setStatus();
// console.log('TESTS PASS');
}
};

Expand Down

0 comments on commit d7a8587

Please sign in to comment.