@@ -34,8 +34,10 @@ describe('leaflet_FeatureService_getFeaturesByBuffer', () => {
3434 spyOn ( FetchRequest , 'commit' ) . and . callFake ( ( method , testUrl , params , options ) => {
3535 expect ( method ) . toBe ( "POST" ) ;
3636 expect ( testUrl ) . toBe ( dataServiceURL + "/featureResults.json?returnContent=true&fromIndex=0&toIndex=19" ) ;
37- expect ( params ) . toContain ( "'attributeFilter':\"SMID%26gt;0\"" ) ;
38- expect ( params ) . toContain ( "'datasetNames':[\"World:Capitals\"]" ) ;
37+ var paramsObj = JSON . parse ( params . replace ( / ' / g, "\"" ) ) ;
38+ expect ( paramsObj . datasetNames [ 0 ] ) . toBe ( "World:Capitals" ) ;
39+ expect ( paramsObj . attributeFilter ) . toBe ( "SMID%26gt;0" ) ;
40+ // expect(params).toContain("'attributeFilter':\"SMID%26gt;0\"");
3941 expect ( options ) . not . toBeNull ( ) ;
4042 return Promise . resolve ( new Response ( JSON . stringify ( getFeaturesResultJson ) ) ) ;
4143 } ) ;
@@ -86,8 +88,10 @@ describe('leaflet_FeatureService_getFeaturesByBuffer', () => {
8688 spyOn ( FetchRequest , 'commit' ) . and . callFake ( ( method , testUrl , params , options ) => {
8789 expect ( method ) . toBe ( "POST" ) ;
8890 expect ( testUrl ) . toBe ( dataServiceURL + "/featureResults.json?" ) ;
89- expect ( params ) . toContain ( "'attributeFilter':\"SMID%26gt;0\"" ) ;
90- expect ( params ) . toContain ( "'bufferDistance':30" ) ;
91+ var paramsObj = JSON . parse ( params . replace ( / ' / g, "\"" ) ) ;
92+ expect ( paramsObj . datasetNames [ 0 ] ) . toBe ( "World:Capitals" ) ;
93+ expect ( paramsObj . attributeFilter ) . toBe ( "SMID%26gt;0" ) ;
94+ expect ( paramsObj . bufferDistance ) . toBe ( 30 ) ;
9195 expect ( options ) . not . toBeNull ( ) ;
9296 return Promise . resolve ( new Response ( `{"postResultType":"CreateChild","newResourceID":"c01d29d8d41743adb673cd1cecda6ed0_02c1636b347046d9b1428bce7118c4df","succeed":true,"newResourceLocation":"http://localhost:8090/iserver/services/data-world/rest/data/featureResults/c01d29d8d41743adb673cd1cecda6ed0_02c1636b347046d9b1428bce7118c4df.json"}` ) ) ;
9397 } ) ;
@@ -126,8 +130,10 @@ describe('leaflet_FeatureService_getFeaturesByBuffer', () => {
126130 spyOn ( FetchRequest , 'commit' ) . and . callFake ( ( method , testUrl , params , options ) => {
127131 expect ( method ) . toBe ( "POST" ) ;
128132 expect ( testUrl ) . toBe ( dataServiceURL + "/featureResults.json?returnContent=true&fromIndex=0&toIndex=19" ) ;
129- expect ( params ) . toContain ( "'attributeFilter':\"SMID%26gt;0\"" ) ;
130- expect ( params ) . toContain ( "'bufferDistance':30" ) ;
133+ var paramsObj = JSON . parse ( params . replace ( / ' / g, "\"" ) ) ;
134+ expect ( paramsObj . datasetNames [ 0 ] ) . toBe ( "World1:Capitals" ) ;
135+ expect ( paramsObj . attributeFilter ) . toBe ( "SMID%26gt;0" ) ;
136+ expect ( paramsObj . bufferDistance ) . toBe ( 30 ) ;
131137 expect ( options ) . not . toBeNull ( ) ;
132138 return Promise . resolve ( new Response ( `{"succeed":false,"error":{"code":400,"errorMsg":"数据源World1不存在,获取相应的数据服务组件失败"}}` ) ) ;
133139 } ) ;
@@ -164,8 +170,9 @@ describe('leaflet_FeatureService_getFeaturesByBuffer', () => {
164170 spyOn ( FetchRequest , 'commit' ) . and . callFake ( ( method , testUrl , params , options ) => {
165171 expect ( method ) . toBe ( "POST" ) ;
166172 expect ( testUrl ) . toBe ( dataServiceURL + "/featureResults.json?returnContent=true&fromIndex=0&toIndex=19" ) ;
167- expect ( params ) . toContain ( "'attributeFilter':\"SMID%26gt;0\"" ) ;
168- expect ( params ) . toContain ( "'bufferDistance':30" ) ;
173+ var paramsObj = JSON . parse ( params . replace ( / ' / g, "\"" ) ) ;
174+ expect ( paramsObj . attributeFilter ) . toBe ( "SMID%26gt;0" ) ;
175+ expect ( paramsObj . bufferDistance ) . toBe ( 30 ) ;
169176 expect ( options ) . not . toBeNull ( ) ;
170177 return Promise . resolve ( new Response ( `{"succeed":false,"error":{"code":400,"errorMsg":"在FeatureResults中,在检验请求体时,请求体参数datasetNames为空"}}` ) ) ;
171178 } ) ;
0 commit comments