Files
awesome-copilot/eng/board-column-order.test.mjs
T
Aaron PowellandCopilot App 6474ff2e8b fix(plugin-board): clarify intake-blocked review eligibility
Keep blocked submissions visible with intake reasons and accurate review controls. Expose eligibility through agent actions and cover blocked-to-ready transitions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1313d2be-6ae2-478e-952a-4b22a5e2d7cb
2026-10-15 12:50:18 +11:00

46 lines
2.2 KiB
JavaScript

import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import vm from "node:vm";
import { test } from "node:test";
for (const boardName of ["open-pr-board", "external-plugin-review-board"]) {
test(`${boardName}: columns render oldest to newest without changing board state`, async () => {
const source = await readFile(
new URL(`../.github/extensions/${boardName}/public/app.js`, import.meta.url), "utf8",
);
const items = [
{ number: 50, column: "approve", createdAt: "2026-10-14T00:00:00Z", updatedAt: "2026-10-14T00:00:00Z" },
{ number: 30, column: "approve", createdAt: "2026-10-01T00:00:00Z", updatedAt: "2026-10-14T01:00:00Z" },
{ number: 10, column: "close", createdAt: "2026-09-01T00:00:00Z" },
{ number: 20, column: "approve", createdAt: "2026-10-01T00:00:00Z" },
{ number: 5, column: "approve", createdAt: "2026-08-01T00:00:00Z", hidden: true },
{ number: 40, column: "close", createdAt: "2026-10-10T00:00:00Z" },
];
const original = structuredClone(items);
const rendered = [];
const node = { querySelectorAll: () => [], replaceChildren() {} };
const ui = {
board: node, title: {}, summary: {}, meta: {}, review: {}, reviewStatus: {},
};
const context = vm.createContext({
board: { items, columns: [{ id: "approve" }, { id: "close" }, { id: "empty" }] },
el: ui, ui, filter: "",
matchesFilter: (item) => !item.hidden,
renderCard: (item) => { rendered.push(item.number); return {}; },
h: () => ({}),
relativeTime: () => "now",
pendingReviewCount: () => 0,
COLUMN_HINTS: {},
});
vm.runInContext(source.slice(source.indexOf("function renderBoard()"), source.indexOf("function columnItems(")), context);
context.renderBoard();
assert.deepEqual(rendered, [20, 30, 50, 10, 40]);
assert.deepEqual(items, original);
items[0].column = "close";
rendered.length = 0;
context.renderBoard();
assert.deepEqual(rendered, [20, 30, 10, 40, 50]);
});
}