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
TL;DR : The documentation about the assert function notSameOrderedMembers have the same explanation than sameOrderedMembers, i.e : Asserts that set1 and set2 have the same members in the same order. Uses a strict equality check (===). Shouldn’t it be Asserts that set1 and set2 don’t have the same members in the same order. Uses a strict equality check (===).
Explanation
I was looking for a function in vitest API to check that a Set has the same objects than another one but in any order. Reading the doc, I found sameOrderedMembers and then notSameOrderedMembers so I thought that it would do what I was expected (i.e assert.notSameOrderedMembers([1, 2, 3], [2, 1, 3], 'not same ordered members')).
Reading the explanation Asserts that set1 and set2 have the same members in the same order. Uses a strict equality check (===)., I was confused because this is not what you expect from the function and not related to the given example.
Does this means that this function checks that members are equals but sorted in different orders or does it assert that every member at every exact position are different ?
Reading the explanation for notSameDeepOrderedMembers, Asserts that set1 and set2 don’t have the same members in the same order. Uses a deep equality check. is what it does for notSameOrderedMembers (with strict equality).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
TL;DR : The documentation about the assert function
notSameOrderedMembers
have the same explanation thansameOrderedMembers
, i.e :Asserts that set1 and set2 have the same members in the same order. Uses a strict equality check (===).
Shouldn’t it beAsserts that set1 and set2 don’t have the same members in the same order. Uses a strict equality check (===).
Explanation
I was looking for a function in vitest API to check that a Set has the same objects than another one but in any order. Reading the doc, I found
sameOrderedMembers
and thennotSameOrderedMembers
so I thought that it would do what I was expected (i.eassert.notSameOrderedMembers([1, 2, 3], [2, 1, 3], 'not same ordered members')
).Reading the explanation
Asserts that set1 and set2 have the same members in the same order. Uses a strict equality check (===).
, I was confused because this is not what you expect from the function and not related to the given example.Does this means that this function checks that members are equals but sorted in different orders or does it assert that every member at every exact position are different ?
What I was expecting is :
assert.notSameOrderedMembers([1, 2, 3], [2, 1, 3], 'not same ordered members')
). =>true
assert.notSameOrderedMembers([1, 2, 3], [3, 2, 1], 'not same ordered members')
). =>true
assert.notSameOrderedMembers([1, 2, 3], [4, 2, 1], 'not same ordered members')
). =>false
assert.notSameOrderedMembers([{ a: 1 }, { a: 2 }, { a: 3 }], [{ a: 1 }, { a: 2 }, { a: 3 }], 'not same ordered members')
). =>false
What it does :
assert.notSameOrderedMembers([1, 2, 3], [2, 1, 3], 'not same ordered members')
). =>true
assert.notSameOrderedMembers([1, 2, 3], [3, 2, 1], 'not same ordered members')
). =>true
assert.notSameOrderedMembers([1, 2, 3], [4, 2, 1], 'not same ordered members')
). =>true
assert.notSameOrderedMembers([{ a: 1 }, { a: 2 }, { a: 3 }], [{ a: 1 }, { a: 2 }, { a: 3 }], 'not same ordered members')
). =>true
Reading the explanation for
notSameDeepOrderedMembers
,Asserts that set1 and set2 don’t have the same members in the same order. Uses a deep equality check.
is what it does fornotSameOrderedMembers
(with strict equality).FYI : the doc in version 1.6.0 seems OK
Beta Was this translation helpful? Give feedback.
All reactions