Skip to content

Commit dbb9ab8

Browse files
committed
test(s3-request-presigner): check for error name and message
1 parent 4ae6dec commit dbb9ab8

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

packages/s3-request-presigner/src/getSignedUrl.spec.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,10 @@ describe("getSignedUrl", () => {
196196
});
197197
});
198198

199-
it("should throw if presign request with MRAP ARN and disableMultiregionAccessPoints option", () => {
199+
it("should throw if presign request with MRAP ARN and disableMultiregionAccessPoints option", async () => {
200200
const mockPresigned = "a presigned url";
201201
vi.mocked(mockS3RequestPresigner.presign).mockReturnValue(mockPresigned as any);
202+
202203
const client = new S3Client({
203204
...clientParams,
204205
disableMultiregionAccessPoints: true,
@@ -207,13 +208,9 @@ describe("getSignedUrl", () => {
207208
Bucket: "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap",
208209
Key: "Key",
209210
});
210-
return expect(getSignedUrl(client, command)).rejects.toEqual(
211-
new (class EndpointError extends Error {
212-
constructor(...args: any[]) {
213-
super(...args);
214-
this.name = "EndpointError";
215-
}
216-
})("Invalid configuration: Multi-Region Access Point ARNs are disabled.")
217-
);
211+
212+
const error = await getSignedUrl(client, command).catch((e) => e);
213+
expect(error.name).toEqual("EndpointError");
214+
expect(error.message).toEqual("Invalid configuration: Multi-Region Access Point ARNs are disabled.");
218215
});
219216
});

0 commit comments

Comments
 (0)