Skip to content

Commit 95134f7

Browse files
chore(jco): fmt
1 parent 9ff6dc2 commit 95134f7

2 files changed

Lines changed: 39 additions & 35 deletions

File tree

crates/test-components/src/bin/stream_tx.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ impl bindings::exports::jco::test_components::get_stream_async::Guest for Compon
122122
stream_values_async(vals)
123123
}
124124

125-
async fn get_stream_fixed_list_u32(vals: Vec<[u32; 5]>) -> Result<StreamReader<[u32; 5]>, String> {
125+
async fn get_stream_fixed_list_u32(
126+
vals: Vec<[u32; 5]>,
127+
) -> Result<StreamReader<[u32; 5]>, String> {
126128
stream_values_async(vals)
127129
}
128130
}

packages/jco/test/p3/stream.js

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ suite("stream<T> lifts", () => {
186186
assert.instanceOf(instance["jco:test-components/get-stream-async"].getStreamFlags, AsyncFunction);
187187

188188
let vals = [
189-
{first: true, second: false, third: false},
190-
{first: false, second: true, third: false},
191-
{first: false, second: false, third: true},
189+
{ first: true, second: false, third: false },
190+
{ first: false, second: true, third: false },
191+
{ first: false, second: false, third: true },
192192
];
193193
let stream = await instance["jco:test-components/get-stream-async"].getStreamFlags(vals);
194194
await checkStreamValues({ stream, vals, typeName: "flags", assertEqFn: assert.deepEqual });
@@ -197,73 +197,75 @@ suite("stream<T> lifts", () => {
197197
test("enum", async () => {
198198
assert.instanceOf(instance["jco:test-components/get-stream-async"].getStreamEnum, AsyncFunction);
199199

200-
let vals = [
201-
'first',
202-
'second',
203-
'third',
204-
];
200+
let vals = ["first", "second", "third"];
205201
let stream = await instance["jco:test-components/get-stream-async"].getStreamEnum(vals);
206-
await checkStreamValues({ stream, vals, typeName: "enum", assertEqFn: assert.deepEqual});
202+
await checkStreamValues({ stream, vals, typeName: "enum", assertEqFn: assert.deepEqual });
207203
});
208204

209205
test("option<string>", async () => {
210206
assert.instanceOf(instance["jco:test-components/get-stream-async"].getStreamOptionString, AsyncFunction);
211207

212-
let vals = [
213-
'present string',
214-
null,
215-
];
208+
let vals = ["present string", null];
216209
let stream = await instance["jco:test-components/get-stream-async"].getStreamOptionString(vals);
217-
await checkStreamValues({ stream, vals, typeName: "option<string>", assertEqFn: assert.deepEqual, expectedValues: [
218-
// TODO: wit type representation smoothing mismatch
219-
{ tag: "some", val: "present string" },
220-
{ tag: "none" },
221-
]});
210+
await checkStreamValues({
211+
stream,
212+
vals,
213+
typeName: "option<string>",
214+
assertEqFn: assert.deepEqual,
215+
expectedValues: [
216+
// TODO: wit type representation smoothing mismatch
217+
{ tag: "some", val: "present string" },
218+
{ tag: "none" },
219+
],
220+
});
222221
});
223222

224223
test("list<string>", async () => {
225224
assert.instanceOf(instance["jco:test-components/get-stream-async"].getStreamListString, AsyncFunction);
226-
let vals = [
227-
[ 'first', 'second', 'third' ],
228-
[],
229-
];
225+
let vals = [["first", "second", "third"], []];
230226
let stream = await instance["jco:test-components/get-stream-async"].getStreamListString(vals);
231-
await checkStreamValues({ stream, vals, typeName: "list<string>", assertEqFn: assert.deepEqual});
227+
await checkStreamValues({ stream, vals, typeName: "list<string>", assertEqFn: assert.deepEqual });
232228
});
233229

234230
test("list<u32, 5>", async () => {
235231
assert.instanceOf(instance["jco:test-components/get-stream-async"].getStreamFixedListU32, AsyncFunction);
236232
let vals = [
237-
[ 1, 2, 3, 4, 5 ],
238-
[ 0, 0, 0, 0, 0 ],
233+
[1, 2, 3, 4, 5],
234+
[0, 0, 0, 0, 0],
239235
];
240236
let stream = await instance["jco:test-components/get-stream-async"].getStreamFixedListU32(vals);
241-
await checkStreamValues({ stream, vals, typeName: "list<string>", assertEqFn: assert.deepEqual});
237+
await checkStreamValues({ stream, vals, typeName: "list<string>", assertEqFn: assert.deepEqual });
242238
// TODO: test misuse of fixed length list
243239
});
244240

245241
test("list<record>", async () => {
246242
assert.instanceOf(instance["jco:test-components/get-stream-async"].getStreamListRecord, AsyncFunction);
247243
let vals = [
248-
[ { id: 1, idStr: "one" } ],
249-
[ { id: 1, idStr: "one" }, { id: 2, idStr: "two" } ],
250-
[ { id: 1, idStr: "one" }, { id: 2, idStr: "two" }, { id: 3, idStr: "three" } ],
244+
[{ id: 1, idStr: "one" }],
245+
[
246+
{ id: 1, idStr: "one" },
247+
{ id: 2, idStr: "two" },
248+
],
249+
[
250+
{ id: 1, idStr: "one" },
251+
{ id: 2, idStr: "two" },
252+
{ id: 3, idStr: "three" },
253+
],
251254
[],
252255
];
253256
let stream = await instance["jco:test-components/get-stream-async"].getStreamListRecord(vals);
254-
await checkStreamValues({ stream, vals, typeName: "list<record>", assertEqFn: assert.deepEqual});
257+
await checkStreamValues({ stream, vals, typeName: "list<record>", assertEqFn: assert.deepEqual });
255258
});
256259

257260
test("result<string>", async () => {
258261
assert.instanceOf(instance["jco:test-components/get-stream-async"].getStreamResultString, AsyncFunction);
259262
let vals = [
260-
{ tag: 'ok', val: 'present string' },
261-
{ tag: 'err', val: 'nope' },
263+
{ tag: "ok", val: "present string" },
264+
{ tag: "err", val: "nope" },
262265
];
263266
let stream = await instance["jco:test-components/get-stream-async"].getStreamResultString(vals);
264-
await checkStreamValues({ stream, vals, typeName: "result<string>", assertEqFn: assert.deepEqual});
267+
await checkStreamValues({ stream, vals, typeName: "result<string>", assertEqFn: assert.deepEqual });
265268
});
266-
267269
});
268270

269271
async function checkStreamValues(args) {

0 commit comments

Comments
 (0)