Refactor: Implement SmartCube renderer, improve UI styling, and fix gaps

This commit is contained in:
2026-02-22 04:35:59 +00:00
parent 57abfd6b80
commit b5ddc21662
4168 changed files with 763782 additions and 1008 deletions

33
node_modules/@gkucmierz/utils/spec/list-node.spec.mjs generated vendored Normal file
View File

@@ -0,0 +1,33 @@
import { ListNode } from '../src/list-node.mjs';
describe('ListNode', () => {
it('constructor', () => {
expect(new ListNode().val).toEqual(0);
expect(new ListNode().next).toEqual(null);
expect(new ListNode(123).val).toEqual(123);
expect(new ListNode(123).next).toEqual(null);
expect(new ListNode(123, 'next').next).toEqual('next');
});
it('toArr', () => {
expect(new ListNode().toArr()).toEqual([0]);
expect(new ListNode(123).toArr()).toEqual([123]);
expect(new ListNode(1, new ListNode(2)).toArr()).toEqual([1, 2]);
});
it('fromArr', () => {
expect(ListNode.fromArr([1, 2])).toEqual(new ListNode(1, new ListNode(2)));
});
it('both', () => {
const arr = [1, 2, 3, 4, 5];
expect(ListNode.fromArr(arr).toArr()).toEqual(arr);
});
it('cyclic reference', () => {
const node = ListNode.fromArr([1, 2]);
node.next.next = node;
expect(() => node.toArr()).toThrow(new Error('Cyclic reference detected'));
});
});