fix(deps): keep Lucide SVG markup and Undici tests compatible

Build standalone SVG icons without a React context. Use accessible actions in tests and give the mocked dispatchers the interface the adapter expects.
This commit is contained in:
Maurice
2026-12-01 13:44:02 +01:00
parent 7f4ece2e6f
commit b77c246df4
15 changed files with 107 additions and 40 deletions
@@ -25,7 +25,14 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
* applied there would hold a hung identity provider open for a quarter of an
* hour on the strength of a model setting.
*/
const { AgentMock } = vi.hoisted(() => ({ AgentMock: vi.fn() }));
const { AgentMock } = vi.hoisted(() => ({
AgentMock: vi.fn(
class {
dispatch = vi.fn();
constructor(_options: Record<string, unknown>) {}
},
),
}));
vi.mock('undici', async (importOriginal) => ({
...(await importOriginal<typeof import('undici')>()),
Agent: AgentMock,
@@ -14,6 +14,7 @@ const built = vi.hoisted(() => ({
vi.mock('undici', async (importOriginal) => ({
...(await importOriginal<typeof import('undici')>()),
Agent: class {
dispatch = vi.fn();
constructor(readonly opts: unknown) {
built.agents.push(opts);
}
@@ -23,6 +24,7 @@ vi.mock('undici', async (importOriginal) => ({
}
},
ProxyAgent: class {
dispatch = vi.fn();
constructor(opts: Record<string, unknown>) {
built.proxies.push(opts);
}
@@ -20,7 +20,14 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
* spread init the lint rule could not see into, waited undici's five minutes
* for a hung host and read whatever size the host sent back into memory.
*/
const { AgentMock } = vi.hoisted(() => ({ AgentMock: vi.fn() }));
const { AgentMock } = vi.hoisted(() => ({
AgentMock: vi.fn(
class {
dispatch = vi.fn();
constructor(_options: Record<string, unknown>) {}
},
),
}));
vi.mock('undici', async (importOriginal) => ({
...(await importOriginal<typeof import('undici')>()),
Agent: AgentMock,
@@ -23,6 +23,7 @@ vi.mock('dns/promises', () => ({
vi.mock('undici', async (importOriginal) => ({
...(await importOriginal<typeof import('undici')>()),
Agent: class MockAgent {
dispatch = vi.fn();
options: any;
constructor(opts: any) {
this.options = opts;