mirror of
https://github.com/enso-org/enso.git
synced 2024-12-18 19:41:32 +03:00
Fix bug causing intermittent GUI unit test failures (#11801)
Fix failing prop test caused by edge case bug in new `findDifferenceIndex`.
This commit is contained in:
parent
f6a900191a
commit
9f0c0c0257
@ -42,7 +42,7 @@ test.prop({
|
||||
test.prop({
|
||||
array: fc.array(fc.anything()),
|
||||
})('findDifferenceIndex (same array)', ({ array }) => {
|
||||
expect(findDifferenceIndex(array, array)).toEqual(array.length)
|
||||
expect(findDifferenceIndex(array, array, Object.is)).toEqual(array.length)
|
||||
})
|
||||
|
||||
test.prop({
|
||||
@ -69,3 +69,8 @@ test.prop({
|
||||
expect(arr1[differenceIndex]).not.toEqual(arr2[differenceIndex])
|
||||
}
|
||||
})
|
||||
|
||||
test('findDifferenceIndex (NaN)', () => {
|
||||
const array = [NaN]
|
||||
expect(findDifferenceIndex(array, array)).toEqual(0)
|
||||
})
|
||||
|
@ -90,7 +90,8 @@ export function partition<T>(array: Iterable<T>, pred: (elem: T) => boolean): [T
|
||||
}
|
||||
|
||||
/**
|
||||
* Find smallest index at which two arrays differ. Returns an index past the array (i.e. array length) when both arrays are equal.
|
||||
* Find smallest index at which two arrays differ. Returns an index past the array (i.e. array length) when both arrays
|
||||
* are equal. Note that the default comparator uses strict equality, and so `NaN` values will be considered different.
|
||||
*/
|
||||
export function findDifferenceIndex<T>(
|
||||
lhs: T[],
|
||||
|
Loading…
Reference in New Issue
Block a user