@@ -33,6 +33,24 @@ describe('openlayers_AddressMatchService', () => {
3333 var codingFailedEventArgs = null , codingSuccessEventArgs = null ;
3434 var codeCompleted = ( analyseEventArgs ) => {
3535 codingSuccessEventArgs = analyseEventArgs ;
36+ try {
37+ expect ( addressCodeService ) . not . toBeNull ( ) ;
38+ expect ( codingSuccessEventArgs ) . not . toBeNull ( ) ;
39+ expect ( codingSuccessEventArgs . type ) . toBe ( 'processCompleted' ) ;
40+ expect ( codingSuccessEventArgs . result ) . not . toBeNull ( ) ;
41+ expect ( codingSuccessEventArgs . result . length ) . toBe ( 10 ) ;
42+ GeoCodingParams . destroy ( ) ;
43+ codingSuccessEventArgs = null ;
44+ codingFailedEventArgs = null ;
45+ done ( ) ;
46+ } catch ( exception ) {
47+ console . log ( "'code'案例失败:" + exception . name + ":" + exception . message ) ;
48+ GeoCodingParams . destroy ( ) ;
49+ codingFailedEventArgs = null ;
50+ codingSuccessEventArgs = null ;
51+ expect ( false ) . toBeTruthy ( ) ;
52+ done ( ) ;
53+ }
3654 } ;
3755 var codeFailed = ( serviceFailedEventArgs ) => {
3856 codingFailedEventArgs = serviceFailedEventArgs ;
@@ -58,26 +76,6 @@ describe('openlayers_AddressMatchService', () => {
5876 return Promise . resolve ( new Response ( codeSuccessEscapedJson ) ) ;
5977 } ) ;
6078 addressCodeService . code ( GeoCodingParams , codeCompleted ) ;
61- setTimeout ( ( ) => {
62- try {
63- expect ( addressCodeService ) . not . toBeNull ( ) ;
64- expect ( codingSuccessEventArgs ) . not . toBeNull ( ) ;
65- expect ( codingSuccessEventArgs . type ) . toBe ( 'processCompleted' ) ;
66- expect ( codingSuccessEventArgs . result ) . not . toBeNull ( ) ;
67- expect ( codingSuccessEventArgs . result . length ) . toBe ( 10 ) ;
68- GeoCodingParams . destroy ( ) ;
69- codingSuccessEventArgs = null ;
70- codingFailedEventArgs = null ;
71- done ( ) ;
72- } catch ( exception ) {
73- console . log ( "'code'案例失败:" + exception . name + ":" + exception . message ) ;
74- GeoCodingParams . destroy ( ) ;
75- codingFailedEventArgs = null ;
76- codingSuccessEventArgs = null ;
77- expect ( false ) . toBeTruthy ( ) ;
78- done ( ) ;
79- }
80- } , 0 ) ;
8179 } ) ;
8280
8381 it ( 'decode' , ( done ) => {
@@ -87,6 +85,24 @@ describe('openlayers_AddressMatchService', () => {
8785 } ;
8886 var decodeCompleted = ( analyseEventArgs ) => {
8987 decodingSuccessEventArgs = analyseEventArgs ;
88+ try {
89+ expect ( addressDeCodeService ) . not . toBeNull ( ) ;
90+ expect ( decodingSuccessEventArgs ) . not . toBeNull ( ) ;
91+ expect ( decodingSuccessEventArgs . type ) . toBe ( 'processCompleted' ) ;
92+ expect ( decodingSuccessEventArgs . result ) . not . toBeNull ( ) ;
93+ expect ( decodingSuccessEventArgs . result . length ) . toEqual ( 5 ) ;
94+ GeoDeCodingParams . destroy ( ) ;
95+ decodingFailedEventArgs = null ;
96+ decodingSuccessEventArgs = null ;
97+ done ( ) ;
98+ } catch ( exception ) {
99+ console . log ( "'decode'案例失败:" + exception . name + ":" + exception . message ) ;
100+ GeoDeCodingParams . destroy ( ) ;
101+ decodingFailedEventArgs = null ;
102+ decodingSuccessEventArgs = null ;
103+ expect ( false ) . toBeTruthy ( ) ;
104+ done ( ) ;
105+ }
90106 } ;
91107 var GeoDeCodingParams = new GeoDecodingParameter ( {
92108 x : 116.31740122415627 ,
@@ -108,31 +124,24 @@ describe('openlayers_AddressMatchService', () => {
108124 return Promise . resolve ( new Response ( decodeSuccessEscapedJson ) ) ;
109125 } ) ;
110126 addressDeCodeService . decode ( GeoDeCodingParams , decodeCompleted ) ;
111- setTimeout ( ( ) => {
127+ } ) ;
128+ it ( 'code_customQueryParam' , ( done ) => {
129+ var codingFailedEventArgs = null , codingSuccessEventArgs = null ;
130+ var codeCompleted = ( analyseEventArgs ) => {
131+ codingSuccessEventArgs = analyseEventArgs ;
112132 try {
113- expect ( addressDeCodeService ) . not . toBeNull ( ) ;
114- expect ( decodingSuccessEventArgs ) . not . toBeNull ( ) ;
115- expect ( decodingSuccessEventArgs . type ) . toBe ( 'processCompleted' ) ;
116- expect ( decodingSuccessEventArgs . result ) . not . toBeNull ( ) ;
117- expect ( decodingSuccessEventArgs . result . length ) . toEqual ( 5 ) ;
118- GeoDeCodingParams . destroy ( ) ;
119- decodingFailedEventArgs = null ;
120- decodingSuccessEventArgs = null ;
133+ GeoCodingParams . destroy ( ) ;
134+ codingSuccessEventArgs = null ;
135+ codingFailedEventArgs = null ;
121136 done ( ) ;
122137 } catch ( exception ) {
123- console . log ( "'decode '案例失败:" + exception . name + ":" + exception . message ) ;
124- GeoDeCodingParams . destroy ( ) ;
125- decodingFailedEventArgs = null ;
126- decodingSuccessEventArgs = null ;
138+ console . log ( "'code '案例失败:" + exception . name + ":" + exception . message ) ;
139+ GeoCodingParams . destroy ( ) ;
140+ codingFailedEventArgs = null ;
141+ codingSuccessEventArgs = null ;
127142 expect ( false ) . toBeTruthy ( ) ;
128143 done ( ) ;
129144 }
130- } , 0 ) ;
131- } ) ;
132- it ( 'code_customQueryParam' , ( done ) => {
133- var codingFailedEventArgs = null , codingSuccessEventArgs = null ;
134- var codeCompleted = ( analyseEventArgs ) => {
135- codingSuccessEventArgs = analyseEventArgs ;
136145 } ;
137146 var codeFailed = ( serviceFailedEventArgs ) => {
138147 codingFailedEventArgs = serviceFailedEventArgs ;
@@ -154,21 +163,6 @@ describe('openlayers_AddressMatchService', () => {
154163 return Promise . resolve ( new Response ( codeSuccessEscapedJson ) ) ;
155164 } ) ;
156165 addressCodeService . code ( GeoCodingParams , codeCompleted ) ;
157- setTimeout ( ( ) => {
158- try {
159- GeoCodingParams . destroy ( ) ;
160- codingSuccessEventArgs = null ;
161- codingFailedEventArgs = null ;
162- done ( ) ;
163- } catch ( exception ) {
164- console . log ( "'code'案例失败:" + exception . name + ":" + exception . message ) ;
165- GeoCodingParams . destroy ( ) ;
166- codingFailedEventArgs = null ;
167- codingSuccessEventArgs = null ;
168- expect ( false ) . toBeTruthy ( ) ;
169- done ( ) ;
170- }
171- } , 0 ) ;
172166 } ) ;
173167
174168 it ( 'decode_customQueryParam' , ( done ) => {
@@ -178,6 +172,19 @@ describe('openlayers_AddressMatchService', () => {
178172 } ;
179173 var decodeCompleted = ( analyseEventArgs ) => {
180174 decodingSuccessEventArgs = analyseEventArgs ;
175+ try {
176+ GeoDeCodingParams . destroy ( ) ;
177+ decodingFailedEventArgs = null ;
178+ decodingSuccessEventArgs = null ;
179+ done ( ) ;
180+ } catch ( exception ) {
181+ console . log ( "'decode'案例失败:" + exception . name + ":" + exception . message ) ;
182+ GeoDeCodingParams . destroy ( ) ;
183+ decodingFailedEventArgs = null ;
184+ decodingSuccessEventArgs = null ;
185+ expect ( false ) . toBeTruthy ( ) ;
186+ done ( ) ;
187+ }
181188 } ;
182189 var GeoDeCodingParams = new GeoDecodingParameter ( {
183190 x : 116.31740122415627 ,
@@ -195,20 +202,5 @@ describe('openlayers_AddressMatchService', () => {
195202 return Promise . resolve ( new Response ( decodeSuccessEscapedJson ) ) ;
196203 } ) ;
197204 addressDeCodeService . decode ( GeoDeCodingParams , decodeCompleted ) ;
198- setTimeout ( ( ) => {
199- try {
200- GeoDeCodingParams . destroy ( ) ;
201- decodingFailedEventArgs = null ;
202- decodingSuccessEventArgs = null ;
203- done ( ) ;
204- } catch ( exception ) {
205- console . log ( "'decode'案例失败:" + exception . name + ":" + exception . message ) ;
206- GeoDeCodingParams . destroy ( ) ;
207- decodingFailedEventArgs = null ;
208- decodingSuccessEventArgs = null ;
209- expect ( false ) . toBeTruthy ( ) ;
210- done ( ) ;
211- }
212- } , 0 ) ;
213205 } ) ;
214206} ) ;
0 commit comments