|
19 | 19 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
20 | 20 | // |
21 | 21 |
|
| 22 | +// Assertions are made conditionally on problem details responses because not all |
| 23 | +// servers support this feature. |
| 24 | +/* eslint-disable jest/no-conditional-expect */ |
| 25 | + |
22 | 26 | import { File as NodeFile, Blob as NodeBlob } from "buffer"; |
23 | 27 | import { |
24 | 28 | jest, |
@@ -329,8 +333,10 @@ describe("Authenticated end-to-end", () => { |
329 | 333 | expect(error.problemDetails.type).toBe(DEFAULT_TYPE); |
330 | 334 | expect(error.problemDetails.title).toBe("Unauthorized"); |
331 | 335 | expect(error.problemDetails.status).toBe(401); |
332 | | - expect(error.problemDetails.detail).toBeDefined(); |
333 | | - expect(error.problemDetails.instance).toBeDefined(); |
| 336 | + if (env?.features?.PROBLEM_DETAILS === "true") { |
| 337 | + expect(error.problemDetails.detail).toBeDefined(); |
| 338 | + expect(error.problemDetails.instance).toBeDefined(); |
| 339 | + } |
334 | 340 | }); |
335 | 341 |
|
336 | 342 | it("can fetch getWellKnownSolid", async () => { |
@@ -398,8 +404,10 @@ describe("Authenticated end-to-end", () => { |
398 | 404 | expect(error.problemDetails.type).toBe(DEFAULT_TYPE); |
399 | 405 | expect(error.problemDetails.title).toBe("Not Acceptable"); |
400 | 406 | expect(error.problemDetails.status).toBe(406); |
401 | | - expect(error.problemDetails.detail).toBeDefined(); |
402 | | - expect(error.problemDetails.instance).toBeDefined(); |
| 407 | + if (env?.features?.PROBLEM_DETAILS === "true") { |
| 408 | + expect(error.problemDetails.detail).toBeDefined(); |
| 409 | + expect(error.problemDetails.instance).toBeDefined(); |
| 410 | + } |
403 | 411 | }); |
404 | 412 |
|
405 | 413 | it("raises error creating a container if service returns an error response", async () => { |
@@ -522,16 +530,20 @@ describe("Authenticated end-to-end", () => { |
522 | 530 | expect(problemDetails.type).toBe(DEFAULT_TYPE); |
523 | 531 | expect(problemDetails.title).toBe("Bad Request"); |
524 | 532 | expect(problemDetails.status).toBe(400); |
525 | | - expect(problemDetails.detail).toBeDefined(); |
526 | | - expect(problemDetails.instance).toBeDefined(); |
| 533 | + if (env?.features?.PROBLEM_DETAILS === "true") { |
| 534 | + expect(problemDetails.detail).toBeDefined(); |
| 535 | + expect(problemDetails.instance).toBeDefined(); |
| 536 | + } |
527 | 537 | } |
528 | 538 |
|
529 | 539 | function expect405ProblemDetails(problemDetails: ProblemDetails) { |
530 | 540 | expect(problemDetails.type).toBe(DEFAULT_TYPE); |
531 | 541 | expect(problemDetails.title).toBe("Method Not Allowed"); |
532 | 542 | expect(problemDetails.status).toBe(405); |
533 | | - expect(problemDetails.detail).toBeDefined(); |
534 | | - expect(problemDetails.instance).toBeDefined(); |
| 543 | + if (env?.features?.PROBLEM_DETAILS === "true") { |
| 544 | + expect(problemDetails.detail).toBeDefined(); |
| 545 | + expect(problemDetails.instance).toBeDefined(); |
| 546 | + } |
535 | 547 | } |
536 | 548 |
|
537 | 549 | function serverToRespondWithAn405Error() { |
|
0 commit comments