Skip to content

Commit

Permalink
Add tests for custom arrayable functions
Browse files Browse the repository at this point in the history
  • Loading branch information
DerTimonius committed Mar 3, 2023
1 parent f6c2e6d commit 0f2c6c0
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions bokehjs/test/unit/core/util/arrayable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,32 @@ describe("core/util/arrayable module", () => {
expect(arrayable.interpolate([], [], [])).to.be.equal([])
expect(arrayable.interpolate([1], [], [])).to.be.equal([NaN])
})

it("should support subselect() function", () => {
const a = [1, 2, 3, 4, 5, 6, undefined]
const b = [1, 4, 5]
expect(arrayable.subselect(a, b)).to.be.equal([2, 5, 6])
const c = [0, 100]
const d = [10, NaN]
expect(arrayable.subselect(a, c)).to.be.equal([1, undefined])
expect(arrayable.subselect(a, d)).to.be.equal([undefined, undefined])
})

it("should support insert() function", () => {
expect(arrayable.insert([1, 2, 3], 4, 1)).to.be.equal([1, 4, 2, 3])
})

it("should support append() function", () => {
expect(arrayable.append([1, 2, 3], 4)).to.be.equal([1, 2, 3, 4])
})

it("should support prepend() function", () => {
expect(arrayable.prepend([1, 2, 3], 4)).to.be.equal([4, 1, 2, 3])
})

it("should support mul() function", () => {
const a = [1, 2, 3]
const b = [2, 4, 6]
expect(arrayable.mul(a, 2)).to.be.equal(b)
})
})

0 comments on commit 0f2c6c0

Please sign in to comment.