* Tests with hypermedia options explicitly enabled for performance comparison
()
| 502 | * Tests with hypermedia options explicitly enabled for performance comparison |
| 503 | */ |
| 504 | async function hypermediaEnabledTests () { |
| 505 | console.log("\n🔥 Hypermedia Enabled Tests"); |
| 506 | console.log("=".repeat(50)); |
| 507 | |
| 508 | const server = createTestServer({ |
| 509 | hypermedia: { |
| 510 | enabled: true, |
| 511 | header: true |
| 512 | } |
| 513 | }); |
| 514 | |
| 515 | const startedServer = await startServer(server); |
| 516 | const baseUrl = `http://localhost:${startedServer.server.address().port}`; |
| 517 | |
| 518 | const tests = [ |
| 519 | { |
| 520 | title: "Ping Test (With Hypermedia)", |
| 521 | url: `${baseUrl}/ping`, |
| 522 | connections: 50, |
| 523 | duration: 10 |
| 524 | }, |
| 525 | { |
| 526 | title: "JSON Response (With Hypermedia)", |
| 527 | url: `${baseUrl}/users`, |
| 528 | connections: 25, |
| 529 | duration: 10 |
| 530 | }, |
| 531 | { |
| 532 | title: "Large JSON Response (With Hypermedia)", |
| 533 | url: `${baseUrl}/large`, |
| 534 | connections: 10, |
| 535 | duration: 10 |
| 536 | }, |
| 537 | { |
| 538 | title: "Parameterized Route (With Hypermedia)", |
| 539 | url: `${baseUrl}/users/42`, |
| 540 | connections: 20, |
| 541 | duration: 10 |
| 542 | } |
| 543 | ]; |
| 544 | |
| 545 | const results = []; |
| 546 | for (const test of tests) { |
| 547 | const result = await runLoadTest(test); |
| 548 | results.push({ ...test, result }); |
| 549 | |
| 550 | await new Promise(resolve => setTimeout(resolve, 1000)); |
| 551 | } |
| 552 | |
| 553 | startedServer.stop(); |
| 554 | |
| 555 | return results; |
| 556 | } |
| 557 | |
| 558 | /** |
| 559 | * Tests with hypermedia options disabled for performance comparison |
no test coverage detected