@@ -16,7 +16,8 @@ const should = chai.should();
1616const expect = chai . expect ;
1717
1818describe ( 'Project create' , ( ) => {
19- before ( ( done ) => {
19+ before ( function beforeHook ( done ) {
20+ this . timeout ( 20000 ) ;
2021 testUtil . clearDb ( )
2122 . then ( ( ) => testUtil . clearES ( ) )
2223 . then ( ( ) => models . ProjectType . bulkCreate ( [
@@ -76,8 +77,16 @@ describe('Project create', () => {
7677 updatedBy : 4 ,
7778 } ,
7879 ] ) )
79- . then ( ( ) => models . ProjectTemplate . bulkCreate ( [
80- {
80+ . then ( ( ) => {
81+ const exceededProducts = [ ] ;
82+ for ( let i = 1 ; i <= _ . parseInt ( config . get ( 'maxPhaseProductCount' ) ) + 1 ; i += 1 ) {
83+ exceededProducts . push ( {
84+ id : i ,
85+ name : `product ${ i } ` ,
86+ productKey : `visual_design_prod${ i } ` ,
87+ } ) ;
88+ }
89+ return models . ProjectTemplate . bulkCreate ( [ {
8190 id : 1 ,
8291 name : 'template 1' ,
8392 key : 'key 1' ,
@@ -91,18 +100,7 @@ describe('Project create', () => {
91100 phase1 : {
92101 name : 'phase 1' ,
93102 duration : 5 ,
94- products : [
95- {
96- id : 21 ,
97- name : 'product 1' ,
98- productKey : 'visual_design_prod1' ,
99- } ,
100- {
101- id : 22 ,
102- name : 'product 2' ,
103- productKey : 'visual_design_prod2' ,
104- } ,
105- ] ,
103+ products : exceededProducts ,
106104 } ,
107105 } ,
108106 createdBy : 1 ,
@@ -206,8 +204,8 @@ describe('Project create', () => {
206204 } ,
207205 createdBy : 1 ,
208206 updatedBy : 2 ,
209- } ,
210- ] ) )
207+ } ] ) ;
208+ } )
211209 . then ( ( ) => models . BuildingBlock . bulkCreate ( [
212210 {
213211 id : 1 ,
0 commit comments