Skip to content

Commit 615e5b1

Browse files
authored
Update normalize-fields.spec.js
1 parent 0e199a6 commit 615e5b1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/components/table/helpers/normalize-fields.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ describe('table/helpers/normalize-fields', () => {
8484
expect(normalizeFields({ foo: false })).toEqual([])
8585
})
8686

87+
it('handles mixed array format', async () => {
88+
const arr1 = ['foo', { bar: { label: 'Bar Label' } }, { baz: 'Baz Label' }]
89+
90+
expect(normalizeFields(arr1, [])).toEqual([
91+
{ key: 'foo', label: 'Foo' },
92+
{ key: 'bar', label: 'Bar Label' },
93+
{ key: 'baz', label: 'Baz Label' }
94+
])
95+
})
96+
8797
it('removes duplicate fields (preserving the first found)', async () => {
8898
const arr1 = ['foo', 'bar', 'foo', 'foo_bar']
8999
const arr2 = [{ key: 'foo', label: 'Fiz' }, 'bar', 'foo', 'foo_bar']

0 commit comments

Comments
 (0)