fix(DockerContainer): Fix getContainerById to return undefined for non-existent containers
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user