mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-14 10:00:06 +00:00
* feat(appfile): Add comprehensive unit tests for appfile package This commit significantly enhances the test coverage for the `pkg/appfile` package by adding a comprehensive suite of new unit tests. These tests improve the reliability of core application parsing, generation, and validation logic. Key additions include: - **Parsing:** New tests for policy parsing, legacy application revision handling, and dynamic component loading. - **Manifest Generation:** Added coverage for `GenerateComponentManifests` and `GeneratePolicyManifests` to ensure correctness of generated resources. - **OAM Contracts:** New tests for `SetOAMContract` and `setWorkloadRefToTrait` to verify OAM label and reference injection. - **Template & Context:** Added tests for loading templates from revisions (`LoadTemplateFromRevision`) and preparing the process context (`PrepareProcessContext`). - **Validation:** Enhanced validation tests for component parameters and uniqueness of output names. As part of this effort, the existing tests were also migrated from Ginkgo to the standard `testing` package with `testify/assert` to maintain consistency across the codebase. Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com> * refactor(pkg/component): Migrate ref-objects tests to standard Go testing and add new test cases This commit refactors the unit tests for `pkg/component/ref-objects` from a Ginkgo-based suite to the standard Go `testing` package. Additionally, new unit test cases have been added to further enhance test coverage and ensure the robustness of the `ref-objects` functionality. Key changes include: - Deletion of `pkg/component/ref_objects_suite_test.go`. - Introduction of `pkg/component/main_test.go` to manage test environment setup and teardown using `TestMain`. - Creation of `pkg/component/ref_objects_test.go` containing all the ref-objects related unit tests, now using standard Go testing functions, along with newly added test cases for improved coverage. This migration improves consistency with other unit tests in the codebase and leverages the native Go testing framework. Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com> * chore(pkg/component): Reorder imports in ref_objects_test.go This commit reorders the import statements in `pkg/component/ref_objects_test.go` to adhere to standard Go formatting and import grouping conventions. This change improves code readability and consistency. Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com> --------- Signed-off-by: Ashvin Bambhaniya <ashvin.bambhaniya@improwised.com>