Skip to content

Commit d696443

Browse files
authored
Update config.spec.js
1 parent bf0e5d8 commit d696443

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/utils/config.spec.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
getDefaults,
33
getConfigParam,
4+
getConfigComponent,
45
getBreakpointsAll,
56
getBreakpointsUp,
67
getBreakpointsDown
@@ -16,6 +17,19 @@ describe('utils/config', () => {
1617
expect(getConfigParam('foo.bar[1].baz')).toBe(null)
1718
})
1819

20+
it('getConfigComponent() works', async () => {
21+
// Specific component config key
22+
expect(getConfigComponent('BAlert', 'variant')).toEqual('info')
23+
// Component's full config
24+
expect(getConfigComponent('BAlert')).toEqual(getDefaults().BAlert)
25+
// Should return a deep clone for full config
26+
expect(getConfigComponent('BAlert')).not.toBe(getDefaults().BAlert)
27+
// Should return empty object for not found component
28+
expect(getConfigComponent('foobar')).toEqual({})
29+
// Should return null for not found component key
30+
expect(getConfigComponent('BAlert', 'foobar')).toBe(null)
31+
})
32+
1933
it('getBreakpointsAll() works', async () => {
2034
expect(getBreakpointsAll()).toEqual(['xs', 'sm', 'md', 'lg', 'xl'])
2135
// Should return a deep clone

0 commit comments

Comments
 (0)