Skip to content

Commit

Permalink
test for #2379
Browse files Browse the repository at this point in the history
  • Loading branch information
urugator committed Jun 19, 2020
1 parent f7fd2ef commit fec22b0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/v4/base/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,3 +590,14 @@ test("correct array should be passed to callbacks #2326", () => {
"some"
].forEach(method => array[method](callback))
})

test("very long arrays can be safely passed to nativeArray.concat #2379", () => {
const nativeArray = ["a", "b"]
const longNativeArray = [...Array(10_000).keys()] // MAX_SPLICE_SIZE seems to be the threshold
const longObservableArray = observable(longNativeArray)

const expectedArray = nativeArray.concat(longNativeArray)
const actualArray = nativeArray.concat(longObservableArray)

expect(actualArray).toEqual(expectedArray)
})
11 changes: 11 additions & 0 deletions test/v5/base/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,3 +625,14 @@ test("correct array should be passed to callbacks #2326", () => {
"some"
].forEach(method => array[method](callback))
})

test("very long arrays can be safely passed to nativeArray.concat #2379", () => {
const nativeArray = ["a", "b"]
const longNativeArray = [...Array(10_000).keys()] // MAX_SPLICE_SIZE seems to be the threshold
const longObservableArray = observable(longNativeArray)

const expectedArray = nativeArray.concat(longNativeArray)
const actualArray = nativeArray.concat(longObservableArray)

expect(actualArray).toEqual(expectedArray)
})

0 comments on commit fec22b0

Please sign in to comment.