Skip to content

test(cicero-core): 100% coverage for ApArchiveLoader#830

Open
rockaxorb13 wants to merge 1 commit intoaccordproject:mainfrom
rockaxorb13:test/ap-loader-coverage
Open

test(cicero-core): 100% coverage for ApArchiveLoader#830
rockaxorb13 wants to merge 1 commit intoaccordproject:mainfrom
rockaxorb13:test/ap-loader-coverage

Conversation

@rockaxorb13
Copy link
Contributor

Description

This PR addresses the low test coverage for ApArchiveLoader in cicero-core.

Previously, aparchiveloader.js had ~16% coverage. The critical logic—specifically the validation of ap:// protocol requirements and the rewriting of URLs before delegation—was untested, and there was no script to test it.

Changes:

  1. Added packages/cicero-core/test/loaders/aparchiveloader.js:

    • Implemented a unit test suite using Sinon to mock the parent HTTPArchiveLoader.
    • This approach verifies the logic of the loader (URL rewriting and error handling) in isolation, ensuring tests are fast and do not rely on external network availability or the status of the Accord Project website.
  2. Updated packages/cicero-core/package.json:

    • Re-applied the --recursive flag for the Mocha test runner to ensure tests in subdirectories (like the new loader tests) are correctly discovered and executed.

Results

Coverage for aparchiveloader.js is now 100%.

Before:

aparchiveloader.js  |  16.66 | 0 | 0 | 16.66

After

aparchiveloader.js  | 100 | 100 | 100 | 100
Screenshot1

Signed-off-by: Aadityavardhan Singh <singhrashmi018@gmail.com>
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