You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My usecase is Ava's deepEqual function. In particular, I have some nested object of some sort. I'm not interested in the value of the values, but in their type. Is it possible to have something like Jest's expect.any(Boolean) for example? Or any dynamic matcher for a value?
Let say I want to check if:
{foo: ['a','b','c'],bar: {cat: newCat(),}}
is equal to
{foo: [String,String,String],bar: {cat: Cat}}
That is: I'm more interested in the structure, rather than actual values (for example they are generated randomly).
The text was updated successfully, but these errors were encountered:
Architecturally Concordance is extensible, though AVA does not expose those hooks. That said, it's meant for use cases like comparing a Timestamp from say the Firestore SDK against a Date. It's not sufficient for your use case.
A technique I've used previously when snapshotting timestamps is to map it to a "yes this is a timestamp" string. You could do something like:
t.deepEqual(structure({
foo: ['a', 'b', 'c'],
bar: {
cat: new Cat(),
}
}), {
foo: ['String', 'String', 'String'],
bar: {
cat: 'Cat'
}
})
Where structure() does some deep mapping to the constructor name.
Structural comparisons would be an interesting addition but Concordance needs modernizing first.
Hello!
My usecase is Ava's
deepEqual
function. In particular, I have some nested object of some sort. I'm not interested in the value of the values, but in their type. Is it possible to have something like Jest'sexpect.any(Boolean)
for example? Or any dynamic matcher for a value?Let say I want to check if:
is equal to
That is: I'm more interested in the structure, rather than actual values (for example they are generated randomly).
The text was updated successfully, but these errors were encountered: