Skip to content

Commit 80ec074

Browse files
fix: validation test
1 parent 357126b commit 80ec074

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

packages/core/test/InteractionOutputTest.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { suite, test } from "@testdeck/mocha";
1818
import promised from "chai-as-promised";
1919
import { expect, use } from "chai";
2020
import { Readable } from "stream";
21-
import { InteractionOutput } from "../src/interaction-output";
21+
import { InteractionOutput, ActionInteractionOutput } from "../src/interaction-output";
2222
import { Content } from "..";
2323
import { fail } from "assert";
2424

@@ -121,12 +121,20 @@ class InteractionOutputTests {
121121
}
122122
}
123123

124-
@test async "should accept returning unexpected value with no validation"() {
125-
// type boolean should not throw since we set ignoreValidation to true
124+
@test async "should accept returning unexpected value with no validation (synchronous==false)"() {
126125
const stream = Readable.from(Buffer.from("not boolean", "utf-8"));
127126
const content = new Content("application/json", stream);
128127

129-
const out = new InteractionOutput(content, {}, { type: "boolean" }, { ignoreValidation: true });
128+
const out = new ActionInteractionOutput(content, {}, { type: "boolean" }, false);
129+
const result = await out.value();
130+
expect(result).to.eql("not boolean");
131+
}
132+
133+
@test async "should accept returning unexpected value with no validation (synchronous===undefined)"() {
134+
const stream = Readable.from(Buffer.from("not boolean", "utf-8"));
135+
const content = new Content("application/json", stream);
136+
137+
const out = new ActionInteractionOutput(content, {}, { type: "boolean" });
130138
const result = await out.value();
131139
expect(result).to.eql("not boolean");
132140
}

0 commit comments

Comments
 (0)