mirror of
https://github.com/oven-sh/bun
synced 2026-02-18 06:41:50 +00:00
25 lines
710 B
TypeScript
25 lines
710 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\nab\nab\nab\nab\nab");
|
|
});
|
|
});
|