Skip to content

test : added unit tests for sorting generators, API errors, profile utils, rate limits, and random utilities - #13

Open
tmdeveloper007 wants to merge 1 commit into
syedahmedkhaderi:mainfrom
tmdeveloper007:test-all-utilities
Open

test : added unit tests for sorting generators, API errors, profile utils, rate limits, and random utilities#13
tmdeveloper007 wants to merge 1 commit into
syedahmedkhaderi:mainfrom
tmdeveloper007:test-all-utilities

Conversation

@tmdeveloper007

Copy link
Copy Markdown

Summary of What Has Been Done:
Added 119 new unit tests across 5 test files covering utility functions in the AlgoBuddy codebase that previously had no test coverage.

Changes Made:

  • tests/sortingGenerators.test.js: 37 tests for all 6 sorting algorithm generators (bubble, selection, insertion, merge, quick, heap) -- verifies correct sorting output, step structure, and edge cases
  • tests/apiErrors.test.js: 17 tests for ApiError subclasses -- verifies name, message, code, and status properties for all 5 error classes
  • tests/profileUtils.test.js: 49 tests for profile sanitization and validation -- tests safeAvatarUrl, safeExternalUrl, sanitizeProfileLinks, buildFormDataFromUser, normalizeProfilePayload, validateProfileForm
  • tests/rateLimits.test.js: 7 tests for rate limit configuration constants
  • tests/random.test.js: 9 tests for cryptographically secure code generation

Impact it Made:

  • All 119 new tests pass (npm run test:ui)
  • ESLint green with no warnings
  • Follows existing test patterns in the codebase (Jest, @jest/globals)

Note: Please assign this PR to the tmdeveloper007 account.

…s, rate limits, and random utilities

- __tests__/sortingGenerators.test.js: 37 tests for all 6 sorting algorithm generators (bubble, selection, insertion, merge, quick, heap)
- __tests__/apiErrors.test.js: 17 tests for ApiError subclasses (ApiError, AuthError, RateLimitError, ValidationError, ConfigError)
- __tests__/profileUtils.test.js: 49 tests for profile sanitization and validation functions
- __tests__/rateLimits.test.js: 7 tests for rate limit configuration constants
- __tests__/random.test.js: 9 tests for cryptographically secure code generation

All 119 new tests pass (npm run test:ui). Lint green. Build OOM pre-existing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant