diff options
author | 2023-10-17 14:10:25 -0700 | |
---|---|---|
committer | 2023-10-17 14:10:25 -0700 | |
commit | 7458b969c5d9971e89d187b687e1924e78da427e (patch) | |
tree | ee3dbf95c728cf407bf49a27826b541e9264a8bd /test/js/third_party/prompts/prompts.test.ts | |
parent | d4a2c29131ec154f5e4db897d4deedab2002cbc4 (diff) | |
parent | e91436e5248d947b50f90b4a7402690be8a41f39 (diff) | |
download | bun-7458b969c5d9971e89d187b687e1924e78da427e.tar.gz bun-7458b969c5d9971e89d187b687e1924e78da427e.tar.zst bun-7458b969c5d9971e89d187b687e1924e78da427e.zip |
Merge branch 'main' into postinstall_3
Diffstat (limited to 'test/js/third_party/prompts/prompts.test.ts')
-rw-r--r-- | test/js/third_party/prompts/prompts.test.ts | 27 |
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"'); +}); |