import { test } from 'node:test' import assert from 'node:assert/strict' import { resizeColumn } from '../src/utils/column-width.ts' test('dragging changes only the selected column and preserves the starting widths', () => { const widths = [100, 240, 180] assert.deepEqual(resizeColumn(widths, 1, 65, 80), [100, 305, 180]) assert.deepEqual(resizeColumn(widths, 1, -50, 80), [100, 190, 180]) assert.deepEqual(widths, [100, 240, 180]) }) test('narrowing stops at the header minimum and widening works again', () => { const widths = [100, 240, 180] assert.deepEqual(resizeColumn(widths, 2, -1000, 96), [100, 240, 96]) assert.deepEqual(resizeColumn([100, 240, 96], 2, 16, 96), [100, 240, 112]) assert.deepEqual(resizeColumn(widths, 0, 0, 72), widths) })