Skip to content

Commit

Permalink
fix: update @openally/result to v1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fraxken committed Jun 21, 2024
1 parent 0c83afe commit d86f56d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 45 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"typescript": "^5.3.3"
},
"dependencies": {
"@openally/result": "^1.2.0",
"@openally/result": "^1.2.1",
"content-type": "^1.0.5",
"lru-cache": "^10.1.0",
"statuses": "^2.0.1",
Expand Down
68 changes: 24 additions & 44 deletions test/safeRequest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(isHTTPError(error)).toBeTruthy();
expect(error.statusCode).toBe(statusCode);
expect(error.data).toBe(payload.toString());
Expand Down Expand Up @@ -99,8 +98,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(isHTTPError(error)).toBeTruthy();
expect(error.statusCode).toBe(statusCode);
expect(error.data).toBe(payload.toString());
Expand Down Expand Up @@ -150,8 +148,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(isHTTPError(error)).toBeTruthy();
expect(error.statusCode).toBe(statusCode);
expect(error.data).toBe(payload.toString());
Expand Down Expand Up @@ -201,8 +198,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(isHTTPError(error)).toBeTruthy();
expect(error.statusCode).toBe(statusCode);
expect(error.data).toBe(payload.toString());
Expand Down Expand Up @@ -508,8 +504,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(isHttpieError(error)).toBeTruthy();
expect(error.message).toStrictEqual(
"An unexpected error occurred when trying to parse the response body (reason: 'invalid media type')."
Expand Down Expand Up @@ -539,8 +534,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(error.message).toStrictEqual("Unsupported encoding 'unknown'.");
expect(error.buffer).toStrictEqual(payload);
expect(error.headers).toMatchObject(headers);
Expand Down Expand Up @@ -739,8 +733,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(isHttpieError(error)).toBeTruthy();
expect(error.message).toStrictEqual(
"An unexpected error occurred when trying to parse the response body (reason: 'invalid media type')."
Expand Down Expand Up @@ -770,8 +763,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(error.message).toStrictEqual("Unsupported encoding 'unknown'.");
expect(error.buffer).toStrictEqual(payload);
expect(error.headers).toMatchObject(headers);
Expand Down Expand Up @@ -970,8 +962,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(isHttpieError(error)).toBeTruthy();
expect(error.message).toStrictEqual(
"An unexpected error occurred when trying to parse the response body (reason: 'invalid media type')."
Expand Down Expand Up @@ -1001,8 +992,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(error.message).toStrictEqual("Unsupported encoding 'unknown'.");
expect(error.buffer).toStrictEqual(payload);
expect(error.headers).toMatchObject(headers);
Expand Down Expand Up @@ -1201,8 +1191,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(isHttpieError(error)).toBeTruthy();
expect(error.message).toStrictEqual(
"An unexpected error occurred when trying to parse the response body (reason: 'invalid media type')."
Expand Down Expand Up @@ -1232,8 +1221,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(error.message).toStrictEqual("Unsupported encoding 'unknown'.");
expect(error.buffer).toStrictEqual(payload);
expect(error.headers).toMatchObject(headers);
Expand Down Expand Up @@ -1369,8 +1357,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(error.message).toStrictEqual("Unsupported encoding 'unknown'.");
expect(error.buffer).toMatchObject(payload);
expect(error.headers).toMatchObject(headers);
Expand Down Expand Up @@ -1398,9 +1385,8 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
expect(err.cause).toBeTruthy();
catch (error) {
expect(error).toBeTruthy();
expect(error.reason).toBeTruthy();
expect(error.message).toStrictEqual(
"An unexpected error occurred when trying to decompress the response body (reason: 'incorrect header check')."
Expand Down Expand Up @@ -1535,8 +1521,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(error.message).toStrictEqual("Unsupported encoding 'unknown'.");
expect(error.buffer).toMatchObject(payload);
expect(error.headers).toMatchObject(headers);
Expand Down Expand Up @@ -1564,9 +1549,8 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
expect(err.cause).toBeTruthy();
catch (error) {
expect(error).toBeTruthy();
expect(error.reason).toBeTruthy();
expect(error.message).toStrictEqual(
"An unexpected error occurred when trying to decompress the response body (reason: 'incorrect header check')."
Expand Down Expand Up @@ -1701,8 +1685,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(error.message).toStrictEqual("Unsupported encoding 'unknown'.");
expect(error.buffer).toMatchObject(payload);
expect(error.headers).toMatchObject(headers);
Expand Down Expand Up @@ -1730,9 +1713,8 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
expect(err.cause).toBeTruthy();
catch (error) {
expect(error).toBeTruthy();
expect(error.reason).toBeTruthy();
expect(error.message).toStrictEqual(
"An unexpected error occurred when trying to decompress the response body (reason: 'incorrect header check')."
Expand Down Expand Up @@ -1867,8 +1849,7 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
catch (error) {
expect(error.message).toStrictEqual("Unsupported encoding 'unknown'.");
expect(error.buffer).toMatchObject(payload);
expect(error.headers).toMatchObject(headers);
Expand Down Expand Up @@ -1896,9 +1877,8 @@ describe("Httpie.safeRequest", () => {
expect(result.ok).toBeFalsy();
result.unwrap();
}
catch (err) {
const error = err.cause;
expect(err.cause).toBeTruthy();
catch (error) {
expect(error).toBeTruthy();
expect(error.reason).toBeTruthy();
expect(error.message).toStrictEqual(
"An unexpected error occurred when trying to decompress the response body (reason: 'incorrect header check')."
Expand Down

0 comments on commit d86f56d

Please sign in to comment.