chaijs / chaijs/deep-eql

Comparing Properties with getters only

Open
#52 3 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.