Files
bun.sh/test/js/node/tty.test.ts
2024-09-03 21:32:52 -07:00

27 lines
697 B
TypeScript

import { describe, expect, it } from "bun:test";
import { isWindows } from "harness";
import { WriteStream } from "node:tty";
describe("WriteStream.prototype.getColorDepth", () => {
it("iTerm ancient", () => {
expect(
WriteStream.prototype.getColorDepth.call(undefined, {
TERM_PROGRAM: "iTerm.app",
}),
).toBe(isWindows ? 24 : 8);
});
it("iTerm modern", () => {
expect(
WriteStream.prototype.getColorDepth.call(undefined, {
TERM_PROGRAM: "iTerm.app",
TERM_PROGRAM_VERSION: 3,
}),
).toBe(24);
});
it("empty", () => {
expect(WriteStream.prototype.getColorDepth.call(undefined, {})).toBe(isWindows ? 24 : 1);
});
});