@@ -21,8 +21,9 @@ describe('test CD module', () => {
21
21
describe ( 'test 发送openapiCD' , async ( ) => {
22
22
const CHECK_INTERVAL = 200 ;
23
23
const DEFAULT_CHECK_KEY = '1234' ;
24
-
24
+ let _appid ;
25
25
beforeEach ( ( ) => {
26
+ _appid = config . appid ;
26
27
config . appid = 123 ;
27
28
config . appkey = 123 ;
28
29
@@ -36,8 +37,7 @@ describe('test CD module', () => {
36
37
} ) ;
37
38
} ) ;
38
39
afterEach ( ( ) => {
39
- delete config . appid ;
40
- delete config . appkey ;
40
+ config . appid = _appid ;
41
41
ajax . request . restore ( ) ;
42
42
} ) ;
43
43
it ( 'beforeOpenapi' , async ( ) => {
@@ -71,10 +71,12 @@ describe('test CD module', () => {
71
71
return '123' ;
72
72
}
73
73
} ;
74
+ const _appid = context . appid ;
74
75
context . appid = 'tsw123' ;
75
76
await CD . openapi ( req , { } ) ;
76
77
expect ( returnJson [ 'code' ] ) . to . equal ( - 2 ) ;
77
78
expect ( returnJson [ 'message' ] ) . to . equal ( 'appid错误' ) ;
79
+ context . appid = _appid ;
78
80
} ) ;
79
81
80
82
it ( '上下文不存在appid' , async ( ) => {
@@ -83,11 +85,12 @@ describe('test CD module', () => {
83
85
return '' ;
84
86
}
85
87
} ;
88
+ const _appid = context . appid ;
86
89
context . appid = '' ;
87
90
await CD . openapi ( req , { } ) ;
88
91
expect ( returnJson [ 'code' ] ) . to . equal ( - 2 ) ;
89
92
expect ( returnJson [ 'message' ] ) . to . equal ( 'appid is required' ) ;
90
-
93
+ context . appid = _appid ;
91
94
} ) ;
92
95
93
96
it ( '上下文不存在appkey' , async ( ) => {
@@ -96,10 +99,12 @@ describe('test CD module', () => {
96
99
return 'tsw123' ;
97
100
}
98
101
} ;
102
+ const _appid = context . appid ;
99
103
context . appid = 'tsw123' ;
100
104
await CD . openapi ( req , { } ) ;
101
105
expect ( returnJson [ 'code' ] ) . to . equal ( - 2 ) ;
102
106
expect ( returnJson [ 'message' ] ) . to . equal ( 'appkey is required' ) ;
107
+ context . appid = _appid ;
103
108
} ) ;
104
109
105
110
it ( 'appid不符合规范' , async ( ) => {
@@ -108,11 +113,13 @@ describe('test CD module', () => {
108
113
return 'tsw123,' ;
109
114
}
110
115
} ;
116
+ const _appid = context . appid ;
111
117
context . appid = 'tsw123,' ;
112
118
context . appkey = 'tsw123,' ;
113
119
await CD . openapi ( req , { } ) ;
114
120
expect ( returnJson [ 'code' ] ) . to . equal ( - 2 ) ;
115
121
expect ( returnJson [ 'message' ] ) . to . equal ( 'appid is required' ) ;
122
+ context . appid = _appid ;
116
123
} ) ;
117
124
118
125
it ( 'checkByCmem' , async ( ) => {
@@ -129,10 +136,12 @@ describe('test CD module', () => {
129
136
return 'tsw123' ;
130
137
}
131
138
} ;
139
+ const _appid = context . appid ;
132
140
context . appid = 'tsw123' ;
133
141
context . appkey = 'tsw123' ;
134
142
await CD . openapi ( req , { } ) ;
135
143
expect ( returnJson [ 'code' ] ) . to . equal ( 0 ) ;
144
+ context . appid = _appid ;
136
145
} ) ;
137
146
138
147
} ) ;
0 commit comments