Files
craftdock/test/sockets/index.test.js
T
Lucas RayanandClaude Sonnet 5.5 640e52c0c9 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>
2026-11-01 22:44:39 -03:00

23 lines
757 B
JavaScript

import { describe, it, expect, vi } from 'vitest';
import { registerSockets } from '../../src/sockets/index.js';
describe('registerSockets', () => {
it('creates /logs and /status namespaces with auth middleware', () => {
const namespaces = {};
const io = {
of: vi.fn((name) => {
const ns = { use: vi.fn(), on: vi.fn() };
namespaces[name] = ns;
return ns;
}),
};
registerSockets(io, {
dockerService: {}, appState: {}, sessionMiddleware: (req, res, next) => next(),
});
expect(io.of).toHaveBeenCalledWith('/logs');
expect(io.of).toHaveBeenCalledWith('/status');
expect(namespaces['/logs'].use).toHaveBeenCalled();
expect(namespaces['/status'].use).toHaveBeenCalled();
});
});