Skip to content

Commit

Permalink
Add failing test for throwing scalars
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfbecker committed Apr 25, 2020
1 parent cda7b24 commit 911d2d2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/same_window.comlink.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,21 @@ describe("Comlink in the same realm", function() {
}
});

it("can rethrow scalars", async function() {
const thing = Comlink.wrap(this.port1);
Comlink.expose(_ => {
throw "oops";
}, this.port2);
try {
await thing();
throw "Should have thrown";
} catch (err) {
expect(err).to.not.eq("Should have thrown");
expect(err).to.be("oops");
expect(typeof err).to.be("string");
}
});

it("can work with parameterized functions", async function() {
const thing = Comlink.wrap(this.port1);
Comlink.expose((a, b) => a + b, this.port2);
Expand Down

0 comments on commit 911d2d2

Please sign in to comment.