Skip to content

Commit 22d6d58

Browse files
fix(tests): test updates
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
1 parent f7a6c50 commit 22d6d58

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

test/cases/http-request/source.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function getResult() {
1111
new Fields([
1212
['User-agent', encoder.encode('WASI-HTTP/0.0.1')],
1313
['Content-type', encoder.encode('application/json')],
14-
])
14+
]),
1515
);
1616

1717
req.setScheme({ tag: 'HTTPS' });
@@ -27,13 +27,14 @@ export function getResult() {
2727
const responseHeaders = incomingResponse.headers().entries();
2828

2929
const headers = Object.fromEntries(
30-
responseHeaders.map(([k, v]) => [k, decoder.decode(v)])
30+
responseHeaders.map(([k, v]) => [k, decoder.decode(v)]),
3131
);
3232

3333
let responseBody;
34-
const incomingBody = incomingResponse.consume();
34+
35+
const incomingBody = incomingResponse.consume().val;
3536
{
36-
const bodyStream = incomingBody.stream();
37+
const bodyStream = incomingBody.stream().val;
3738
// const bodyStreamPollable = bodyStream.subscribe();
3839
const buf = bodyStream.blockingRead(500n);
3940
// TODO: actual streaming

test/cases/http-server/source.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import {
99
export const incomingHandler = {
1010
handle(incomingRequest, responseOutparam) {
1111
const outgoingResponse = new OutgoingResponse(new Fields());
12-
let outgoingBody = outgoingResponse.body();
12+
let outgoingBody = outgoingResponse.body().val;
1313
{
14-
let outputStream = outgoingBody.write();
14+
let outputStream = outgoingBody.write().val;
1515
outputStream.blockingWriteAndFlush(
1616
new Uint8Array(new TextEncoder().encode('Hello world!')),
1717
);

test/cases/variants/world.wit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ interface variants {
131131
is-clone-arg: func(a: is-clone);
132132
is-clone-return: func() -> is-clone;
133133

134-
return-named-option: func() -> (a: option<u8>);
135-
return-named-result: func() -> (a: result<u8, my-errno>);
134+
return-named-option: func() -> option<u8>;
135+
return-named-result: func() -> result<u8, my-errno>;
136136
}
137137

138138
world my-world {

test/test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ suite('Builtins', () => {
3636
`
3737
package local:runworld;
3838
world runworld {
39-
export run: func() -> ();
39+
export run: func();
4040
}
4141
`,
4242
{
@@ -271,6 +271,7 @@ suite('WASI', () => {
271271
export const run = {
272272
run () {
273273
result = \`NOW: \${now().seconds}, RANDOM: \${getRandomBytes(2n)}\`;
274+
return { tag: 'ok' };
274275
}
275276
};
276277

0 commit comments

Comments
 (0)