Initial commit: CraftDock as of 2026-11-01

The previous GitHub history was lost with the account (the local .git was missing
its refs and most objects), so this repository starts from the existing code.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Sonnet 5.5 committed 2026-11-01 22:44:39 -03:00
commit 640e52c0c9
99 files changed
+12115

No files matched your search

@@ -0,0 +1,38 @@
// test/services/dockerServiceStreams.test.js
import { describe, it, expect, vi } from 'vitest';
import { createDockerService } from '../../src/services/dockerService.js';
function mockDocker() {
const container = {
inspect: vi.fn().mockResolvedValue({ State: {}, Config: { Env: [] } }),
logs: vi.fn().mockResolvedValue('LOGSTREAM'),
attach: vi.fn().mockResolvedValue('ATTACHSTREAM'),
};
return {
_container: container,
listContainers: vi.fn().mockResolvedValue([{ Names: ['/mc'], Id: 'x' }]),
getContainer: vi.fn().mockReturnValue(container),
};
}
describe('dockerService streams', () => {
it('logStream requests a following log stream with tail', async () => {
const docker = mockDocker();
const svc = createDockerService({ mcContainerName: 'mc' }, docker);
const stream = await svc.logStream();
expect(stream).toBe('LOGSTREAM');
expect(docker._container.logs).toHaveBeenCalledWith(
expect.objectContaining({ follow: true, stdout: true, stderr: true })
);
});
it('attach requests a duplex stream with stdin', async () => {
const docker = mockDocker();
const svc = createDockerService({ mcContainerName: 'mc' }, docker);
const stream = await svc.attach();
expect(stream).toBe('ATTACHSTREAM');
expect(docker._container.attach).toHaveBeenCalledWith(
expect.objectContaining({ stream: true, stdin: true })
);
});
});