Comparing Properties with getters only
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 112
- Forks
- 45
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 1
Description
I have an immutable data structure defined as follow:
let DataStructure = function (name, description, imageUrl, linkUrl) {
let _name = name;
let _description = description;
let _imageUrl = imageUrl;
let _linkUrl = linkUrl;
Object.defineProperty(this, 'name', {
get: () => _name,
});
Object.defineProperty(this, 'description', {
get: () => _description,
});
Object.defineProperty(this, 'imageUrl', {
get: () => _imageUrl,
});
Object.defineProperty(this, 'linkUrl', {
get: () => _linkUrl,
});
};
Comparing to object instances with different values always returns true when it should return false.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the comparison with two DataStructure instances whose getter-only properties return different values, then inspect the deep-eql comparison behavior involved. Done means those instances compare as unequal, with a regression test covering the getter-only properties.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100