Comments (5)
@rahulworks-git Hello, can you provide an example? Do you mean you also want to assert the order of the array? If yes, this package doesn't do it.
from chai-exclude.
@mesaugat Sure.
json_1 = {
"data":
[
{
"_id": "181",
"date_time": "2008-03-11T22:24:00.000Z",
"document_id": "111",
"exp_id": "f7w7d6hs",
"note_length": "5027"
},
{
"_id": "182",
"date_time": "2001-12-18T15:53:00.000Z",
"document_id": "123",
"encounter_id": "ha7sd7hahsd6",
"note_length": "10400"
},
{
"_id": "183",
"date_time": "2001-11-20T01:43:00.000Z",
"document_id": "134",
"exp_id": "jjasd8721",
"note_length": "6281"
},
{
"note_id": "184",
"date_time": "2009-10-03T21:46:00.000Z",
"document_id": "167",
"exp_id": "sadasd871hj2",
"note_length": "5792"
}
]
}
json_2 = {
"data":
[
{
"_id": "183",
"date_time": "2001-11-20T01:43:00.000Z",
"document_id": "134",
"exp_id": "jjasd8721",
"note_length": "6281"
},
{
"_id": "181",
"date_time": "2008-03-11T22:24:00.000Z",
"document_id": "111",
"exp_id": "f7w7d6hs",
"note_length": "5027"
}
,
{
"note_id": "184",
"date_time": "2009-10-03T21:46:00.000Z",
"document_id": "167",
"exp_id": "sadasd871hj2",
"note_length": "5792"
},
{
"_id": "182",
"date_time": "2001-12-18T15:53:00.000Z",
"document_id": "123",
"encounter_id": "ha7sd7hahsd6",
"note_length": "10400"
}
]
}
When i am using deepEqualExcludingEvery, then i get the response that the above 2 json are not the same whereas i am expecting them be the same. For my use case, the order of the records in an array does not matter, only the elements inside the array should not be different.
from chai-exclude.
@rahulworks-git Got it. Deep equality in chai by default seems to also care about the order of the objects. (Didn't know about this 😅)
Maybe you can use this plugin: https://github.com/oprogramador/deep-equal-in-any-order
expect(json_1).excludingEvery('a').to.deep.equalInAnyOrder(json_2)
from chai-exclude.
@mesaugat This seemed to have worked partially. I need some help from you. Is it possible to connect over any meeting platform? Maybe i can share screen for a while and discuss the use case.
from chai-exclude.
@rahulworks-git Hey sorry Rahul, I'm generally busy with my work. You can create an issue in the repository and I can take a look at it when I find the time.
Closing this issue for now.
from chai-exclude.
Related Issues (16)
- Add a new method `excludingEvery` which will delete all properties within an object HOT 4
- Create a TypeScript definition file for chai-exclude HOT 1
- excludeEvery doesn't work for elements in arrays HOT 3
- exclude property path HOT 6
- Add assert variant HOT 5
- Update TypeScript declaration file to include `deepEqualExcluding` and `deepEqualExcludingEvery`
- Classes are being returned as empty arrays HOT 1
- RangeError: Maximum call stack size exceeded with deepEqualExlcudingEvery HOT 12
- Module '"chai-exclude"' has no default export.ts HOT 2
- Syntax for http response style JSON HOT 3
- Issue with eql HOT 1
- Support for excluding property in nested Array HOT 1
- Exclude specific nested key and not every? HOT 4
- Chai v5 support HOT 3
- Deep equal comparison of MongoDB Object Ids always passes when using .excluding HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chai-exclude.