import { test } from 'node:test'; import assert from 'node:assert/strict'; import { wrapIndex } from './carousel.logic.ts'; test('wrapIndex is identity within range', () => { assert.equal(wrapIndex(0, 3), 0); assert.equal(wrapIndex(2, 3), 2); }); test('wrapIndex wraps forward past the last frame to the first', () => { assert.equal(wrapIndex(3, 3), 0); assert.equal(wrapIndex(4, 3), 1); }); test('wrapIndex wraps backward past the first frame to the last', () => { assert.equal(wrapIndex(-1, 3), 2); assert.equal(wrapIndex(-2, 3), 1); });