Add unit tests for the ComputedProperty class #20826
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This pull request introduces a new file, computed-property-test.js, which adds unit tests for the get method of the ComputedProperty class. These tests validate different scenarios and edge cases to ensure proper behavior of the get method when interacting with computed properties in Ember.js.
Test Cases:
CT1: Validates that get returns undefined when the revision is not set, and validateTag returns false.
CT2: Ensures get returns the expected computed value when the revision is set, and validateTag returns false.
CT3: Confirms get returns the computed value when the revision is not set, but validateTag returns true.
CT4: Validates the behavior when dependent keys are present, and validateTag returns false.
CT5: Tests get when the computed property returns an array value.
Simulated Conditions:
Used helper functions such as metaFor, tagFor, tagMetaFor, and validateTag to simulate metadata and tag-related behaviors.
Assertions:
Each test uses assert methods like equal and deepEqual to confirm that the returned values match the expected outcomes.
Purpose:
These tests enhance the coverage and reliability of the ComputedProperty class, ensuring its behavior aligns with expected results under various conditions.