aboutsummaryrefslogtreecommitdiff
path: root/test/js/third_party/prompts/prompts.test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'test/js/third_party/prompts/prompts.test.ts')
-rw-r--r--test/js/third_party/prompts/prompts.test.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/js/third_party/prompts/prompts.test.ts b/test/js/third_party/prompts/prompts.test.ts
new file mode 100644
index 000000000..7e052fa6d
--- /dev/null
+++ b/test/js/third_party/prompts/prompts.test.ts
@@ -0,0 +1,27 @@
+import path from "path";
+import { bunExe, bunEnv } from "harness";
+
+test("works with prompts", async () => {
+ var child = Bun.spawn({
+ cmd: [bunExe(), path.join(import.meta.dir, "prompts.js")],
+ env: bunEnv,
+ stdout: "pipe",
+ stdin: "pipe",
+ });
+
+ child.stdin.write("dylan\n");
+ Bun.sleepSync(100);
+ child.stdin.write("999\n");
+ Bun.sleepSync(100);
+ child.stdin.write("hi\n");
+ expect(await child.exited).toBe(0);
+
+ var out = "";
+ for await (const chunk of child.stdout) {
+ out += new TextDecoder().decode(chunk);
+ }
+
+ expect(out).toContain('twitter: "@dylan"');
+ expect(out).toContain("age: 999");
+ expect(out).toContain('secret: "hi"');
+});