Skip to content

Commit 776be0c

Browse files
committed
Change the order of tests
1 parent ebdb763 commit 776be0c

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

packages/npm-packages/ruby-wasm-wasi/test-e2e/integrations/js-require-remote.spec.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,26 @@ if (!process.env.RUBY_NPM_PACKAGE_ROOT) {
6868
expect(await resolve()).toBe(false);
6969
});
7070

71+
test("JS::RequireRemote#load throws error when gem is not found", async ({
72+
page,
73+
}) => {
74+
// Opens the URL that will be used as the basis for determining the relative URL.
75+
await page.goto(
76+
"https://cdn.jsdelivr.net/npm/ruby-head-wasm-wasi@latest/dist/",
77+
);
78+
await page.setContent(`
79+
<script src="https://cdn.jsdelivr.net/npm/ruby-head-wasm-wasi@latest/dist/browser.script.iife.js">
80+
</script>
81+
<script type="text/ruby" data-eval="async">
82+
require 'js/require_remote'
83+
JS::RequireRemote.instance.load 'foo'
84+
</script>
85+
`);
86+
87+
const error = await page.waitForEvent("pageerror");
88+
expect(error.message).toMatch(/cannot load such url -- .+\/foo.rb/);
89+
});
90+
7191
// TODO: This test fails.
7292
// In the integration test, response#url returns the URL before the redirect.
7393
// I do not know the cause. Under investigation.
@@ -94,25 +114,5 @@ if (!process.env.RUBY_NPM_PACKAGE_ROOT) {
94114

95115
expect(await resolve()).toBe(false);
96116
});
97-
98-
test("JS::RequireRemote#load throws error when gem is not found", async ({
99-
page,
100-
}) => {
101-
// Opens the URL that will be used as the basis for determining the relative URL.
102-
await page.goto(
103-
"https://cdn.jsdelivr.net/npm/ruby-head-wasm-wasi@latest/dist/",
104-
);
105-
await page.setContent(`
106-
<script src="https://cdn.jsdelivr.net/npm/ruby-head-wasm-wasi@latest/dist/browser.script.iife.js">
107-
</script>
108-
<script type="text/ruby" data-eval="async">
109-
require 'js/require_remote'
110-
JS::RequireRemote.instance.load 'foo'
111-
</script>
112-
`);
113-
114-
const error = await page.waitForEvent("pageerror");
115-
expect(error.message).toMatch(/cannot load such url -- .+\/foo.rb/);
116-
});
117117
});
118118
}

0 commit comments

Comments
 (0)