@@ -16,7 +16,8 @@ const should = chai.should();
16
16
const expect = chai . expect ;
17
17
18
18
describe ( 'Project create' , ( ) => {
19
- before ( ( done ) => {
19
+ before ( function beforeHook ( done ) {
20
+ this . timeout ( 20000 ) ;
20
21
testUtil . clearDb ( )
21
22
. then ( ( ) => testUtil . clearES ( ) )
22
23
. then ( ( ) => models . ProjectType . bulkCreate ( [
@@ -76,8 +77,16 @@ describe('Project create', () => {
76
77
updatedBy : 4 ,
77
78
} ,
78
79
] ) )
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 ( [ {
81
90
id : 1 ,
82
91
name : 'template 1' ,
83
92
key : 'key 1' ,
@@ -91,18 +100,7 @@ describe('Project create', () => {
91
100
phase1 : {
92
101
name : 'phase 1' ,
93
102
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 ,
106
104
} ,
107
105
} ,
108
106
createdBy : 1 ,
@@ -206,8 +204,8 @@ describe('Project create', () => {
206
204
} ,
207
205
createdBy : 1 ,
208
206
updatedBy : 2 ,
209
- } ,
210
- ] ) )
207
+ } ] ) ;
208
+ } )
211
209
. then ( ( ) => models . BuildingBlock . bulkCreate ( [
212
210
{
213
211
id : 1 ,
0 commit comments