Skip to content

test: add comprehensive tests for Index functionality #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

maxcherey
Copy link
Contributor

Add Comprehensive Tests for Index Functionality

This PR adds comprehensive test coverage for the Index functionality in the ctipackage. The changes include:

Added Tests

  • Test_ReadIndex: Tests reading an index from a directory path
  • Test_DecodeIndex: Tests JSON decoding with both valid and invalid JSON input
  • Test_GenerateIndexRaml: Tests RAML generation with and without examples
  • Test_Clone: Tests deep copying functionality
  • Test_ToBytes: Tests JSON marshaling
  • Test_Save: Tests saving index to file
  • Test_PutSerialized: Tests adding serialized files
  • Test_GetEntities: Tests entity retrieval
  • Test_GetAssets: Tests asset retrieval

Test Coverage

All new tests are passing successfully. The tests cover both success and error cases, ensuring robust validation of the Index functionality.

Testing

Run the tests with:

go test ./metadata/ctipackage -v

Note: There are two unrelated failing tests in the codebase:

  1. Test_ParseAnnotations/annotations - Failing due to missing golden file
  2. Test_InvalidPackage/missing_file - Failing due to error message mismatch

These failures are in existing tests and not related to our new test additions.

@maxcherey maxcherey closed this Apr 16, 2025
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