feat: expand advanced widget experiences
This commit is contained in:
1 parent
9437d211c8
commit
c099a8eef6
119 files changed
+3624
-844
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
import { throwIfDockerOperationsFailed } from "../../docker/docker-operation-results";
|
||||
|
||||
describe("Docker operation results", () => {
|
||||
test("accepts an all-success result", async () => {
|
||||
const results = await Promise.allSettled([Promise.resolve(), Promise.resolve()]);
|
||||
|
||||
expect(() => throwIfDockerOperationsFailed(results)).not.toThrow();
|
||||
});
|
||||
|
||||
test("throws a sanitized error after a partial failure", async () => {
|
||||
const results = await Promise.allSettled([
|
||||
Promise.resolve(),
|
||||
Promise.reject(new Error("sensitive Docker daemon response")),
|
||||
]);
|
||||
|
||||
expect(() => throwIfDockerOperationsFailed(results)).toThrow(
|
||||
new TRPCError({
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
message: "One or more Docker container operations failed",
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user