Closed soanvig closed 1 year ago
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.
Understood, thanks for the idea for the solution :)
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).