fix(DockerContainer): Fix getContainerById to return undefined for non-existent containers

This commit is contained in:
2025-11-24 16:03:04 +00:00
parent 2ecd4e9d7c
commit 35e8eff092
7 changed files with 97 additions and 6 deletions

View File

@@ -165,6 +165,22 @@ tap.test('should expose a working DockerImageStore', async () => {
);
});
// CONTAINER GETTERS
tap.test('should return undefined for non-existent container', async () => {
const container = await testDockerHost.getContainerById('invalid-container-id-12345');
expect(container).toEqual(undefined);
});
tap.test('should return container for valid container ID', async () => {
const containers = await testDockerHost.listContainers();
if (containers.length > 0) {
const validId = containers[0].Id;
const container = await testDockerHost.getContainerById(validId);
expect(container).toBeInstanceOf(docker.DockerContainer);
expect(container?.Id).toEqual(validId);
}
});
// CONTAINER STREAMING FEATURES
let testContainer: docker.DockerContainer;