[PR #5882] Add test coverage and URI utilities for hoppscotch-data package #5393

Open
opened 2026-03-17 02:50:41 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5882
Author: @amussara
Created: 2/16/2026
Status: 🔄 Open

Base: mainHead: add-data-utils-tests-and-validation


📝 Commits (1)

  • 7f143d1 feat(hoppscotch-data): add comprehensive test suite and URI utilities

📊 Changes

13 files changed (+1225 additions, -11 deletions)

View changed files

📝 packages/hoppscotch-data/package.json (+5 -3)
packages/hoppscotch-data/src/environment/__tests__/environment.spec.ts (+280 -0)
packages/hoppscotch-data/src/rest/__tests__/content-types.spec.ts (+56 -0)
packages/hoppscotch-data/src/utils/__tests__/collection.spec.ts (+47 -0)
packages/hoppscotch-data/src/utils/__tests__/eq.spec.ts (+122 -0)
packages/hoppscotch-data/src/utils/__tests__/record.spec.ts (+78 -0)
packages/hoppscotch-data/src/utils/__tests__/statusCodes.spec.ts (+103 -0)
packages/hoppscotch-data/src/utils/__tests__/uri.spec.ts (+227 -0)
packages/hoppscotch-data/src/utils/uri.ts (+150 -0)
📝 packages/hoppscotch-data/tsconfig.decl.json (+2 -1)
📝 packages/hoppscotch-data/tsconfig.json (+2 -1)
packages/hoppscotch-data/vitest.config.ts (+9 -0)
📝 pnpm-lock.yaml (+144 -6)

📄 Description

113 tests + new URI utility module with 5 functions. Zero to full test coverage on hoppscotch-data.


Summary by cubic

Adds a URI utilities module and 113 unit tests to bring hoppscotch-data to full coverage and improve URL handling. This strengthens reliability and adds safe URL parsing/building helpers for request workflows.

  • New Features

    • New URI utilities: safeParseURL, isValidURL, extractQueryParams, buildURLWithParams, joinURLPath.
    • Handles missing protocols by defaulting to https, preserves existing query params, and joins base/path cleanly.
  • Dependencies

    • Adds Vitest and a test script; includes vitest.config.ts.
    • Excludes test files from TypeScript builds in tsconfig.
    • No runtime dependency changes.

Written for commit 7f143d1235. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5882 **Author:** [@amussara](https://github.com/amussara) **Created:** 2/16/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `add-data-utils-tests-and-validation` --- ### 📝 Commits (1) - [`7f143d1`](https://github.com/hoppscotch/hoppscotch/commit/7f143d123568c2e209d1d7fea621b2094e7a4b22) feat(hoppscotch-data): add comprehensive test suite and URI utilities ### 📊 Changes **13 files changed** (+1225 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-data/package.json` (+5 -3) ➕ `packages/hoppscotch-data/src/environment/__tests__/environment.spec.ts` (+280 -0) ➕ `packages/hoppscotch-data/src/rest/__tests__/content-types.spec.ts` (+56 -0) ➕ `packages/hoppscotch-data/src/utils/__tests__/collection.spec.ts` (+47 -0) ➕ `packages/hoppscotch-data/src/utils/__tests__/eq.spec.ts` (+122 -0) ➕ `packages/hoppscotch-data/src/utils/__tests__/record.spec.ts` (+78 -0) ➕ `packages/hoppscotch-data/src/utils/__tests__/statusCodes.spec.ts` (+103 -0) ➕ `packages/hoppscotch-data/src/utils/__tests__/uri.spec.ts` (+227 -0) ➕ `packages/hoppscotch-data/src/utils/uri.ts` (+150 -0) 📝 `packages/hoppscotch-data/tsconfig.decl.json` (+2 -1) 📝 `packages/hoppscotch-data/tsconfig.json` (+2 -1) ➕ `packages/hoppscotch-data/vitest.config.ts` (+9 -0) 📝 `pnpm-lock.yaml` (+144 -6) </details> ### 📄 Description 113 tests + new URI utility module with 5 functions. Zero to full test coverage on hoppscotch-data. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds a URI utilities module and 113 unit tests to bring hoppscotch-data to full coverage and improve URL handling. This strengthens reliability and adds safe URL parsing/building helpers for request workflows. - **New Features** - New URI utilities: safeParseURL, isValidURL, extractQueryParams, buildURLWithParams, joinURLPath. - Handles missing protocols by defaulting to https, preserves existing query params, and joins base/path cleanly. - **Dependencies** - Adds Vitest and a test script; includes vitest.config.ts. - Excludes test files from TypeScript builds in tsconfig. - No runtime dependency changes. <sup>Written for commit 7f143d123568c2e209d1d7fea621b2094e7a4b22. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5393
No description provided.