Skip to content

Commit 306a892

Browse files
test(jco): add leftover tests
1 parent a7e274f commit 306a892

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

packages/jco/test/p3/stream-lowers.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,4 +510,55 @@ suite("stream<T> lowers", () => {
510510
throw new Error("NOT YET IMPLEMENTED");
511511
});
512512
});
513+
514+
// test.concurrent("example-resource", async () => {
515+
// assert.instanceOf(
516+
// instance["jco:test-components/stream-lower-async"].readStreamValuesExampleResourceOwn,
517+
// AsyncFunction,
518+
// );
519+
520+
// let vals = [new ExampleResource(0), new ExampleResource(1), new ExampleResource(2)];
521+
// await instance["jco:test-components/stream-lower-async"].readStreamValuesExampleResourceOwn(
522+
// createReadableStreamFromValues(vals),
523+
// );
524+
// // TODO(fix): we shoudl be able to ensure destructor call
525+
// // see: https://github.com/bytecodealliance/jco/issues/989
526+
// // assert(vals.every(r => r.dropped));
527+
// });
528+
529+
// test.concurrent("example-resource#get-id", async () => {
530+
// assert.instanceOf(
531+
// instance["jco:test-components/stream-lower-async"].readStreamValuesExampleResourceOwnAttr,
532+
// AsyncFunction,
533+
// );
534+
535+
// let vals = [new ExampleResource(2), new ExampleResource(1), new ExampleResource(0)];
536+
// const returnedVals = await instance[
537+
// "jco:test-components/stream-lower-async"
538+
// ].readStreamValuesExampleResourceOwnAttr(createReadableStreamFromValues(vals));
539+
// assert.deepEqual(returnedVals, [2, 1, 0]);
540+
// });
541+
542+
// test.concurrent("stream<string>", async () => {
543+
// assert.instanceOf(instance["jco:test-components/stream-lower-async"].readStreamValuesStreamString, AsyncFunction);
544+
545+
// let vals = [
546+
// createReadableStreamFromValues(["first", "stream", "values"]),
547+
// createReadableStreamFromValues(["second", "stream", "here"]),
548+
// createReadableStreamFromValues(["third", "values", "in stream"]),
549+
// ];
550+
// const returnedVals = await instance["jco:test-components/stream-lower-async"].readStreamValuesStreamString(
551+
// createReadableStreamFromValues(vals),
552+
// );
553+
// assert.deepEqual(returnedVals, [
554+
// ["first", "stream", "values"],
555+
// ["second", "stream", "here"],
556+
// ["third", "values", "in stream"],
557+
// ]);
558+
// });
559+
560+
// // TODO
561+
// test.skip("stream<future<string>>", async () => {
562+
// throw new Error("NOT YET IMPLEMENTED");
563+
// });
513564
});

0 commit comments

Comments
 (0)