Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sdk-rtl/src/delimArray): Fixed issue with single element number array #927

Merged
merged 2 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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