Just a whole lot of crap

This commit is contained in:
2025-08-14 16:36:12 -05:00
parent 66b7e42275
commit 62f6d6f279
144 changed files with 41421 additions and 2458 deletions

View File

@@ -0,0 +1,21 @@
// Mock ink-select-input for testing
const React = require("react");
const SelectInput = ({ items, onSelect, ...props }) =>
React.createElement(
"select",
{
...props,
onChange: (e) => onSelect && onSelect(items[e.target.selectedIndex]),
},
items.map((item, index) =>
React.createElement(
"option",
{ key: index, value: item.value },
item.label
)
)
);
module.exports = SelectInput;
module.exports.default = SelectInput;

View File

@@ -0,0 +1,8 @@
// Mock ink-spinner for testing
const React = require("react");
const Spinner = ({ type = "dots", ...props }) =>
React.createElement("span", { ...props, "data-testid": "spinner" }, "⠋");
module.exports = Spinner;
module.exports.default = Spinner;

View File

@@ -0,0 +1,22 @@
// Mock for ink-testing-library
const React = require("react");
const render = (component) => {
// Simple mock that just returns a basic structure
return {
lastFrame: () => "Mocked render output",
frames: ["Mocked render output"],
unmount: jest.fn(),
rerender: jest.fn(),
stdin: {
write: jest.fn(),
},
stdout: {
write: jest.fn(),
},
};
};
module.exports = {
render,
};

View File

@@ -0,0 +1,13 @@
// Mock ink-text-input for testing
const React = require("react");
const TextInput = ({ value, onChange, placeholder, ...props }) =>
React.createElement("input", {
...props,
value,
onChange: (e) => onChange && onChange(e.target.value),
placeholder,
});
module.exports = TextInput;
module.exports.default = TextInput;

18
tests/__mocks__/ink.js Normal file
View File

@@ -0,0 +1,18 @@
// Mock Ink components for testing
const React = require("react");
const Box = ({ children, ...props }) =>
React.createElement("div", props, children);
const Text = ({ children, ...props }) =>
React.createElement("span", props, children);
const useInput = jest.fn();
const useApp = jest.fn(() => ({ exit: jest.fn() }));
module.exports = {
Box,
Text,
useInput,
useApp,
render: jest.fn(),
};