Files
bun.sh/test/js/bun/shell/commands/yes.test.ts
Zack Radisic 45a0559374 Fix some shell things (#20649)
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Zack Radisic <zackradisic@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: robobun <robobun@oven.sh>
2025-07-16 19:46:31 -07:00

25 lines
706 B
TypeScript

import { $ } from "bun";
import { describe, expect, test } from "bun:test";
$.throws(false);
describe("yes", async () => {
test("can pipe to a buffer", async () => {
const buffer = Buffer.alloc(10);
await $`yes > ${buffer}`;
expect(buffer.toString()).toEqual("y\ny\ny\ny\ny\n");
});
test("can be overwritten by the first argument", async () => {
const buffer = Buffer.alloc(18);
await $`yes xy > ${buffer}`;
expect(buffer.toString()).toEqual("xy\nxy\nxy\nxy\nxy\nxy\n");
});
test("ignores other arguments", async () => {
const buffer = Buffer.alloc(17);
await $`yes ab cd ef > ${buffer}`;
expect(buffer.toString()).toEqual("ab cd ef\nab cd ef");
});
});