Skip to content

Commit

Permalink
fix(sdk-rtl/src/delimArray): Fixed issue with single element number a…
Browse files Browse the repository at this point in the history
…rray (#927)

Based on the all the info added here and offline discussion with @joeldodge79, the failing jobs aren't related to the changes in this PR. Go going ahead with the merge.

Thanks @joeldodge79 @jkaster for the review.
  • Loading branch information
akash-looker authored Dec 21, 2021
1 parent 9331631 commit 6e94d73
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions packages/sdk-rtl/src/delimArray.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ describe('DelimArray', () => {
expect(actual).toEqual('{1 2 3 4}')
})

it('integer', () => {
const numbers = [2]
let values = new DelimArray<number>(numbers)
const expected = '2'
let actual = values.toString()
const normal = `${numbers}`
expect(normal).toEqual(expected)
expect(actual).toEqual(expected)
values = new DelimArray<number>(numbers, ' ', '{', '}')
actual = values.toString()
expect(actual).toEqual('{2}')
})

it('strings', () => {
const strings = ['a', 'b', 'c', 'd']
let values = new DelimArray<string>(strings)
Expand Down
3 changes: 2 additions & 1 deletion packages/sdk-rtl/src/delimArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export class DelimArray<T> extends Array<T> {
public prefix: string = '',
public suffix: string = ''
) {
super(...(items || []))
super()
this.push(...(items || []))
}

static create<T>(): DelimArray<T> {
Expand Down

0 comments on commit 6e94d73

Please sign in to comment.