40 lines
862 B
TypeScript
40 lines
862 B
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
const { canSubmitInputBoxMessage } = await import(
|
|
new URL("./input-box-submit.ts", import.meta.url).href
|
|
);
|
|
|
|
void test("rejects empty submits without new or existing attachments", () => {
|
|
assert.equal(
|
|
canSubmitInputBoxMessage({
|
|
text: " ",
|
|
attachmentCount: 0,
|
|
referenceCount: 0,
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
|
|
void test("allows empty-text submits when new attachments are present", () => {
|
|
assert.equal(
|
|
canSubmitInputBoxMessage({
|
|
text: " ",
|
|
attachmentCount: 1,
|
|
referenceCount: 0,
|
|
}),
|
|
true,
|
|
);
|
|
});
|
|
|
|
void test("allows empty-text submits when existing references are present", () => {
|
|
assert.equal(
|
|
canSubmitInputBoxMessage({
|
|
text: " ",
|
|
attachmentCount: 0,
|
|
referenceCount: 1,
|
|
}),
|
|
true,
|
|
);
|
|
});
|