@@ -2,7 +2,9 @@ import faker from 'faker';
2
2
import { noop } from 'lodash' ;
3
3
import mock from '../../../../../shared/testUtils/mock' ;
4
4
import resetState from '../../../testUtils/resetState' ;
5
+ import { dummyTest } from '../../../testUtils/testDummy' ;
5
6
import { OPERATION_MODE_STATELESS } from '../../constants' ;
7
+ import { get } from '../../hooks' ;
6
8
import runWithContext from '../../lib/runWithContext' ;
7
9
import { getSuite } from '../state' ;
8
10
import createSuite from '.' ;
@@ -94,6 +96,25 @@ describe('Test createSuite module', () => {
94
96
expect ( getSuite ( suiteId ) ) . toMatchSnapshot ( ) ;
95
97
} ) ;
96
98
99
+ it ( 'Should be able to get the suite from the result of createSuite' , ( ) => {
100
+ const testsCb = jest . fn ( ) ;
101
+ const suiteId = 'test_get_suite' ;
102
+ expect ( createSuite ( suiteId , testsCb ) . get ( ) ) . toBe ( get ( suiteId ) ) ;
103
+ } ) ;
104
+
105
+ it ( 'Should be able to reset the suite from the result of createSuite' , ( ) => {
106
+ const suiteId = 'test_reset_suite' ;
107
+ const testSuite = createSuite ( suiteId , ( ) => {
108
+ dummyTest . failing ( 'f1' , 'm1' ) ;
109
+ } ) ;
110
+ testSuite ( ) ;
111
+ expect ( get ( suiteId ) . hasErrors ( ) ) . toBe ( true ) ;
112
+ expect ( get ( suiteId ) . testCount ) . toBe ( 1 ) ;
113
+ testSuite . reset ( ) ;
114
+ expect ( get ( suiteId ) . hasErrors ( ) ) . toBe ( false ) ;
115
+ expect ( get ( suiteId ) . testCount ) . toBe ( 0 ) ;
116
+ } ) ;
117
+
97
118
it ( 'Should return without calling tests callback' , ( ) => {
98
119
const validate = runCreateSuite ( ) ;
99
120
expect ( testsCb ) . not . toHaveBeenCalled ( ) ;
0 commit comments