@@ -126,18 +126,18 @@ describe('type assertions', async () => {
126126 describe ( 'toMatchSnapshot' , ( ) => {
127127
128128 it ( 'should be supported correctly' , async ( ) => {
129- expectPromiseVoid = expect ( element ) . toMatchSnapshot ( )
130- expectPromiseVoid = expect ( element ) . toMatchSnapshot ( 'test label' )
131- expectPromiseVoid = expect ( element ) . not . toMatchSnapshot ( 'test label' )
129+ expectVoid = expect ( element ) . toMatchSnapshot ( )
130+ expectVoid = expect ( element ) . toMatchSnapshot ( 'test label' )
131+ expectVoid = expect ( element ) . not . toMatchSnapshot ( 'test label' )
132132
133133 expectPromiseVoid = expect ( chainableElement ) . toMatchSnapshot ( )
134134 expectPromiseVoid = expect ( chainableElement ) . toMatchSnapshot ( 'test label' )
135135 expectPromiseVoid = expect ( chainableElement ) . not . toMatchSnapshot ( 'test label' )
136136
137137 //@ts -expect-error
138- expectVoid = expect ( element ) . toMatchSnapshot ( )
138+ expectPromiseVoid = expect ( element ) . toMatchSnapshot ( )
139139 //@ts -expect-error
140- expectVoid = expect ( element ) . not . toMatchSnapshot ( )
140+ expectPromiseVoid = expect ( element ) . not . toMatchSnapshot ( )
141141 //@ts -expect-error
142142 expectVoid = expect ( chainableElement ) . toMatchSnapshot ( )
143143 //@ts -expect-error
@@ -154,16 +154,16 @@ describe('type assertions', async () => {
154154 describe ( 'toMatchInlineSnapshot' , ( ) => {
155155
156156 it ( 'should be correctly supported' , async ( ) => {
157- expectPromiseVoid = expect ( element ) . toMatchInlineSnapshot ( )
158- expectPromiseVoid = expect ( element ) . toMatchInlineSnapshot ( 'test snapshot' )
159- expectPromiseVoid = expect ( element ) . toMatchInlineSnapshot ( 'test snapshot' , 'test label' )
157+ expectVoid = expect ( element ) . toMatchInlineSnapshot ( )
158+ expectVoid = expect ( element ) . toMatchInlineSnapshot ( 'test snapshot' )
159+ expectVoid = expect ( element ) . toMatchInlineSnapshot ( 'test snapshot' , 'test label' )
160160
161161 expectPromiseVoid = expect ( chainableElement ) . toMatchInlineSnapshot ( )
162162 expectPromiseVoid = expect ( chainableElement ) . toMatchInlineSnapshot ( 'test snapshot' )
163163 expectPromiseVoid = expect ( chainableElement ) . toMatchInlineSnapshot ( 'test snapshot' , 'test label' )
164164
165165 //@ts -expect-error
166- expectVoid = expect ( element ) . toMatchInlineSnapshot ( )
166+ expectPromiseVoid = expect ( element ) . toMatchInlineSnapshot ( )
167167 //@ts -expect-error
168168 expectVoid = expect ( chainableElement ) . toMatchInlineSnapshot ( 'test snapshot' , 'test label' )
169169 } )
@@ -499,37 +499,69 @@ describe('type assertions', async () => {
499499 } )
500500
501501 describe ( '@types/jest only - original Matchers' , ( ) => {
502- const propertyMatchers : Partial < { } > = { }
503- const snapshotName : string = 'test-snapshot'
504- describe ( 'toMatchSnapshot' , ( ) => {
502+ describe ( 'toMatchSnapshot & toMatchInlineSnapshot' , ( ) => {
503+ const snapshotName : string = 'test-snapshot'
504+
505+ it ( 'should work with string' , async ( ) => {
506+ const jsonString : string = '{}'
507+ const propertyMatchers = 'test'
508+ expectVoid = expect ( jsonString ) . toMatchSnapshot ( propertyMatchers )
509+ expectVoid = expect ( jsonString ) . toMatchSnapshot ( propertyMatchers , snapshotName )
510+ expectVoid = expect ( jsonString ) . toMatchInlineSnapshot ( propertyMatchers )
511+ expectVoid = expect ( jsonString ) . toMatchInlineSnapshot ( propertyMatchers , snapshotName )
512+
513+ expectVoid = expect ( jsonString ) . not . toMatchSnapshot ( propertyMatchers )
514+ expectVoid = expect ( jsonString ) . not . toMatchSnapshot ( propertyMatchers , snapshotName )
515+ expectVoid = expect ( jsonString ) . not . toMatchInlineSnapshot ( propertyMatchers )
516+ expectVoid = expect ( jsonString ) . not . toMatchInlineSnapshot ( propertyMatchers , snapshotName )
517+
518+ // @ts -expect-error
519+ expectPromiseVoid = expect ( jsonString ) . toMatchSnapshot ( propertyMatchers )
520+ // @ts -expect-error
521+ expectPromiseVoid = expect ( jsonString ) . toMatchSnapshot ( propertyMatchers , snapshotName )
522+ // @ts -expect-error
523+ expectPromiseVoid = expect ( jsonString ) . toMatchInlineSnapshot ( propertyMatchers )
524+ // @ts -expect-error
525+ expectPromiseVoid = expect ( jsonString ) . toMatchInlineSnapshot ( propertyMatchers , snapshotName )
526+ // @ts -expect-error
527+ expectPromiseVoid = expect ( jsonString ) . not . toMatchSnapshot ( propertyMatchers )
528+ // @ts -expect-error
529+ expectPromiseVoid = expect ( jsonString ) . not . toMatchSnapshot ( propertyMatchers , snapshotName )
530+ // @ts -expect-error
531+ expectPromiseVoid = expect ( jsonString ) . not . toMatchInlineSnapshot ( propertyMatchers )
532+ // @ts -expect-error
533+ expectPromiseVoid = expect ( jsonString ) . not . toMatchInlineSnapshot ( propertyMatchers , snapshotName )
534+ } )
505535
506- it ( 'should have original jest Matcher still works' , async ( ) => {
507- expectVoid = expect ( element ) . toMatchSnapshot ( propertyMatchers )
508- expectVoid = expect ( element ) . toMatchSnapshot ( propertyMatchers , snapshotName )
509- expectVoid = expect ( element ) . toMatchInlineSnapshot ( propertyMatchers )
510- expectVoid = expect ( element ) . toMatchInlineSnapshot ( propertyMatchers , snapshotName )
536+ it ( 'should with object' , async ( ) => {
537+ const treeObject = { 1 : 'test' , 2 : 'test2' }
538+ const propertyMatchers = { 1 : 'test' }
539+ expectVoid = expect ( treeObject ) . toMatchSnapshot ( propertyMatchers )
540+ expectVoid = expect ( treeObject ) . toMatchSnapshot ( propertyMatchers , snapshotName )
541+ expectVoid = expect ( treeObject ) . toMatchInlineSnapshot ( propertyMatchers )
542+ expectVoid = expect ( treeObject ) . toMatchInlineSnapshot ( propertyMatchers , snapshotName )
511543
512- expectVoid = expect ( element ) . not . toMatchSnapshot ( propertyMatchers )
513- expectVoid = expect ( element ) . not . toMatchSnapshot ( propertyMatchers , snapshotName )
514- expectVoid = expect ( element ) . not . toMatchInlineSnapshot ( propertyMatchers )
515- expectVoid = expect ( element ) . not . toMatchInlineSnapshot ( propertyMatchers , snapshotName )
544+ expectVoid = expect ( treeObject ) . not . toMatchSnapshot ( propertyMatchers )
545+ expectVoid = expect ( treeObject ) . not . toMatchSnapshot ( propertyMatchers , snapshotName )
546+ expectVoid = expect ( treeObject ) . not . toMatchInlineSnapshot ( propertyMatchers )
547+ expectVoid = expect ( treeObject ) . not . toMatchInlineSnapshot ( propertyMatchers , snapshotName )
516548
517549 // @ts -expect-error
518- expectPromiseVoid = expect ( element ) . toMatchSnapshot ( propertyMatchers )
550+ expectPromiseVoid = expect ( treeObject ) . toMatchSnapshot ( propertyMatchers )
519551 // @ts -expect-error
520- expectPromiseVoid = expect ( element ) . toMatchSnapshot ( propertyMatchers , snapshotName )
552+ expectPromiseVoid = expect ( treeObject ) . toMatchSnapshot ( propertyMatchers , snapshotName )
521553 // @ts -expect-error
522- expectPromiseVoid = expect ( element ) . toMatchInlineSnapshot ( propertyMatchers )
554+ expectPromiseVoid = expect ( treeObject ) . toMatchInlineSnapshot ( propertyMatchers )
523555 // @ts -expect-error
524- expectPromiseVoid = expect ( element ) . toMatchInlineSnapshot ( propertyMatchers , snapshotName )
556+ expectPromiseVoid = expect ( treeObject ) . toMatchInlineSnapshot ( propertyMatchers , snapshotName )
525557 // @ts -expect-error
526- expectPromiseVoid = expect ( element ) . not . toMatchSnapshot ( propertyMatchers )
558+ expectPromiseVoid = expect ( treeObject ) . not . toMatchSnapshot ( propertyMatchers )
527559 // @ts -expect-error
528- expectPromiseVoid = expect ( element ) . not . toMatchSnapshot ( propertyMatchers , snapshotName )
560+ expectPromiseVoid = expect ( treeObject ) . not . toMatchSnapshot ( propertyMatchers , snapshotName )
529561 // @ts -expect-error
530- expectPromiseVoid = expect ( element ) . not . toMatchInlineSnapshot ( propertyMatchers )
562+ expectPromiseVoid = expect ( treeObject ) . not . toMatchInlineSnapshot ( propertyMatchers )
531563 // @ts -expect-error
532- expectPromiseVoid = expect ( element ) . not . toMatchInlineSnapshot ( propertyMatchers , snapshotName )
564+ expectPromiseVoid = expect ( treeObject ) . not . toMatchInlineSnapshot ( propertyMatchers , snapshotName )
533565 } )
534566 } )
535567 } )
0 commit comments