Skip to content

Commit 873393a

Browse files
committed
fix: test for invalid and missing images
1 parent c16529b commit 873393a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/lib/docker.spec.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,18 @@ describe("docker", () => {
217217
const result = docker.save(image, destination);
218218

219219
// rejects with expected error
220-
await expect(result).rejects.toThrowError("server error");
220+
await expect(result).rejects.toThrowError("not found");
221+
expect(existsSync(destination)).toBeFalsy();
222+
});
223+
224+
test("promise rejects when image is invalid", async () => {
225+
const image = "someImage:latest";
226+
const destination = "/tmp/image.tar";
227+
228+
const result = docker.save(image, destination);
229+
230+
// rejects with expected error
231+
await expect(result).rejects.toThrowError("bad request");
221232
expect(existsSync(destination)).toBeFalsy();
222233
});
223234

0 commit comments

Comments
 (0)