@@ -76,31 +76,25 @@ describe('Polygon', () => {
76
76
} , done . fail ) ;
77
77
} ) ;
78
78
79
- it ( 'fail save with 3 point minumum' , done => {
80
- try {
79
+ it ( 'fail save with 3 point minumum' , ( ) => {
80
+ expect ( function ( ) {
81
81
new Parse . Polygon ( [ [ 0 , 0 ] ] ) ;
82
- } catch ( e ) {
83
- done ( ) ;
84
- }
82
+ } ) . toThrow ( ) ;
85
83
} ) ;
86
84
87
- it ( 'fail save with non array' , done => {
88
- try {
85
+ it ( 'fail save with non array' , ( ) => {
86
+ expect ( function ( ) {
89
87
new Parse . Polygon ( 123 ) ;
90
- } catch ( e ) {
91
- done ( ) ;
92
- }
88
+ } ) . toThrow ( ) ;
93
89
} ) ;
94
90
95
- it ( 'fail save with invalid array' , done => {
96
- try {
91
+ it ( 'fail save with invalid array' , ( ) => {
92
+ expect ( function ( ) {
97
93
new Parse . Polygon ( [ [ 'str1' ] , [ 'str2' ] , [ 'str3' ] ] ) ;
98
- } catch ( e ) {
99
- done ( ) ;
100
- }
94
+ } ) . toThrow ( ) ;
101
95
} ) ;
102
96
103
- it ( 'containsPoint' , done => {
97
+ it ( 'containsPoint' , ( ) => {
104
98
const points = [
105
99
[ 0 , 0 ] ,
106
100
[ 0 , 1 ] ,
@@ -113,10 +107,9 @@ describe('Polygon', () => {
113
107
114
108
assert . equal ( polygon . containsPoint ( inside ) , true ) ;
115
109
assert . equal ( polygon . containsPoint ( outside ) , false ) ;
116
- done ( ) ;
117
110
} ) ;
118
111
119
- it ( 'equality' , done => {
112
+ it ( 'equality' , ( ) => {
120
113
const points = [
121
114
[ 0 , 0 ] ,
122
115
[ 0 , 1 ] ,
@@ -129,7 +122,6 @@ describe('Polygon', () => {
129
122
[ 2 , 2 ] ,
130
123
[ 2 , 0 ] ,
131
124
] ;
132
-
133
125
const polygonA = new Parse . Polygon ( points ) ;
134
126
const polygonB = new Parse . Polygon ( points ) ;
135
127
const polygonC = new Parse . Polygon ( diff ) ;
@@ -140,11 +132,9 @@ describe('Polygon', () => {
140
132
141
133
assert . equal ( polygonA . equals ( true ) , false ) ;
142
134
assert . equal ( polygonA . equals ( polygonC ) , false ) ;
143
-
144
- done ( ) ;
145
135
} ) ;
146
136
147
- it ( 'supports polygonContains' , done => {
137
+ it ( 'supports polygonContains' , async ( ) => {
148
138
const p1 = [
149
139
[ 0 , 0 ] ,
150
140
[ 0 , 1 ] ,
@@ -164,7 +154,6 @@ describe('Polygon', () => {
164
154
[ 15 , 10 ] ,
165
155
[ 10 , 10 ] ,
166
156
] ;
167
-
168
157
const polygon1 = new Parse . Polygon ( p1 ) ;
169
158
const polygon2 = new Parse . Polygon ( p2 ) ;
170
159
const polygon3 = new Parse . Polygon ( p3 ) ;
@@ -173,17 +162,12 @@ describe('Polygon', () => {
173
162
const obj2 = new TestObject ( { polygon : polygon2 } ) ;
174
163
const obj3 = new TestObject ( { polygon : polygon3 } ) ;
175
164
176
- Parse . Object . saveAll ( [ obj1 , obj2 , obj3 ] )
177
- . then ( ( ) => {
178
- const point = new Parse . GeoPoint ( 0.5 , 0.5 ) ;
179
- const query = new Parse . Query ( TestObject ) ;
180
- query . polygonContains ( 'polygon' , point ) ;
181
- return query . find ( ) ;
182
- } )
183
- . then ( results => {
184
- assert . equal ( results . length , 2 ) ;
185
- done ( ) ;
186
- } , done . fail ) ;
165
+ await Parse . Object . saveAll ( [ obj1 , obj2 , obj3 ] ) ;
166
+ const point = new Parse . GeoPoint ( 0.5 , 0.5 ) ;
167
+ const query = new Parse . Query ( TestObject ) ;
168
+ query . polygonContains ( 'polygon' , point ) ;
169
+ const results = await query . find ( ) ;
170
+ assert . equal ( results . length , 2 ) ;
187
171
} ) ;
188
172
189
173
it ( 'polygonContains invalid input' , done => {
0 commit comments