@@ -5,7 +5,10 @@ import test from 'ava' // eslint-disable-line import/no-extraneous-dependencies
55
66import MakeConsoleHook , { ConsoleOutput } from '../internals/ConsoleHook'
77import FlagIconFactory from '../../'
8- import { AddNoExtraPropsValidator } from '../../functions/propTypes'
8+ import {
9+ AddNoExtraPropsValidator ,
10+ AddThemeStylesValidator ,
11+ } from '../../functions/propTypes'
912
1013/**
1114 * TODO: remove 'ConsoleHook' as soon as possible. SEE: "Add ability to throw
@@ -99,4 +102,26 @@ test('No extra props validator', (t: *) => {
99102
100103 // No errors because there are no `extra` props.
101104 t . falsy ( consoleHook . flushLog ( ) )
105+
106+ // If it's applied two times it returns the same object.
107+ const propTypesBis = {
108+ lorem : PropTypes . string ,
109+ ipsum : PropTypes . bool ,
110+ }
111+ const resultPropTypes = AddNoExtraPropsValidator ( propTypesBis )
112+ const secondTimePropTypes = AddNoExtraPropsValidator ( resultPropTypes )
113+
114+ t . deepEqual ( resultPropTypes , secondTimePropTypes )
115+ } )
116+
117+ test ( 'AddThemeStylesValidator' , ( t : * ) => {
118+ // If it's applied two times it returns the same object.
119+ const propTypesBis = {
120+ lorem : PropTypes . string ,
121+ ipsum : PropTypes . bool ,
122+ }
123+ const resultPropTypes = AddThemeStylesValidator ( propTypesBis )
124+ const secondTimePropTypes = AddThemeStylesValidator ( resultPropTypes )
125+
126+ t . deepEqual ( resultPropTypes , secondTimePropTypes )
102127} )
0 commit comments