@@ -14,6 +14,7 @@ it('should init set and utils', () => {
1414 remove : expect . any ( Function ) ,
1515 toggle : expect . any ( Function ) ,
1616 reset : expect . any ( Function ) ,
17+ clear : expect . any ( Function ) ,
1718 } ) ;
1819} ) ;
1920
@@ -145,10 +146,21 @@ it('should reset to initial set provided', () => {
145146 expect ( result . current [ 0 ] ) . toEqual ( new Set ( [ 1 ] ) ) ;
146147} ) ;
147148
149+ it ( 'should be empty' , ( ) => {
150+ const { result } = setUp ( new Set ( [ 1 ] ) ) ;
151+ const [ , utils ] = result . current ;
152+
153+ act ( ( ) => {
154+ utils . clear ( ) ;
155+ } ) ;
156+
157+ expect ( result . current [ 0 ] ) . toEqual ( new Set ( [ ] ) ) ;
158+ } ) ;
159+
148160it ( 'should memoized its utils methods' , ( ) => {
149161 const { result } = setUp ( new Set ( [ 'a' , 'b' ] ) ) ;
150162 const [ , utils ] = result . current ;
151- const { add, remove, reset, toggle } = utils ;
163+ const { add, remove, reset, clear , toggle } = utils ;
152164
153165 act ( ( ) => {
154166 add ( 'foo' ) ;
@@ -158,4 +170,5 @@ it('should memoized its utils methods', () => {
158170 expect ( result . current [ 1 ] . remove ) . toBe ( remove ) ;
159171 expect ( result . current [ 1 ] . toggle ) . toBe ( toggle ) ;
160172 expect ( result . current [ 1 ] . reset ) . toBe ( reset ) ;
173+ expect ( result . current [ 1 ] . clear ) . toBe ( clear ) ;
161174} ) ;
0 commit comments