You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-07 23:02:56 +03:00
Additional tests for 'url' property to satisfy code coverage
This commit is contained in:
@@ -114,6 +114,32 @@ describe("parseErrorResponse", () => {
|
|||||||
}, 500));
|
}, 500));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should resolve Matrix Errors from XHR with urls", () => {
|
||||||
|
expect(parseErrorResponse({
|
||||||
|
responseURL: "https://example.com",
|
||||||
|
getResponseHeader(name: string): string | null {
|
||||||
|
return name === "Content-Type" ? "application/json" : null;
|
||||||
|
},
|
||||||
|
status: 500,
|
||||||
|
} as XMLHttpRequest, '{"errcode": "TEST"}')).toStrictEqual(new MatrixError({
|
||||||
|
errcode: "TEST",
|
||||||
|
}, 500, "https://example.com"));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should resolve Matrix Errors from fetch with urls", () => {
|
||||||
|
expect(parseErrorResponse({
|
||||||
|
url: "https://example.com",
|
||||||
|
headers: {
|
||||||
|
get(name: string): string | null {
|
||||||
|
return name === "Content-Type" ? "application/json" : null;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
status: 500,
|
||||||
|
} as Response, '{"errcode": "TEST"}')).toStrictEqual(new MatrixError({
|
||||||
|
errcode: "TEST",
|
||||||
|
}, 500, "https://example.com"));
|
||||||
|
});
|
||||||
|
|
||||||
it("should handle no type gracefully", () => {
|
it("should handle no type gracefully", () => {
|
||||||
expect(parseErrorResponse({
|
expect(parseErrorResponse({
|
||||||
headers: {
|
headers: {
|
||||||
|
Reference in New Issue
Block a user