· 5 years ago · Oct 15, 2020, 09:54 PM
1// Import the dependencies for testing
2import chai from 'chai'
3import chaiHttp from 'chai-http'
4import createSingleRecord from "../units/create_single_record";
5import updateSingleRecord from "../units/update_single_record";
6import deleteMultipleRecords from "../units/delete_multiple_records";
7
8// MARK: The server address
9const SERVER_URL = 'http://localhost:4006'
10// MARK: API Key for Zapier
11const API_KEY = 'qcIHMCh1dOimp4MX'
12const AUTHORIZATION = 'Bearer ' + API_KEY
13
14// Configure chai
15chai.use(chaiHttp)
16chai.should()
17
18export default () =>
19// MARK: Trigger Test
20describe('# Trigger Test', () => {
21
22 describe('## Preparing Test Data', () => {
23 createSingleRecord()
24 updateSingleRecord()
25 })
26
27 describe('## Single Record Update', () => {
28
29 context('TEST TRIGGER - SRU - CHECKBOX - Checked', () => {
30 it("should be done successfully.", (done) => {
31 chai.request(SERVER_URL)
32 .post('/api/zapier/execute/16')
33 .set('Authorization', AUTHORIZATION)
34 .set('content-type', 'application/json; charset=utf-8')
35 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"16"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":16},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
36 .end((err, res) => {
37 res.should.have.status(200)
38 res.body.result.should.be.a('array')
39 res.body.result.should.lengthOf(1)
40 res.body.result[0].should.have.property('id')
41 res.body.result[0].should.have.property('tableRecordId')
42 done()
43 })
44 })
45 })
46
47 context('TEST TRIGGER - SRU - CHECKBOX - Unchecked', () => {
48 it("should be done successfully.", (done) => {
49 chai.request(SERVER_URL)
50 .post('/api/zapier/execute/17')
51 .set('Authorization', AUTHORIZATION)
52 .set('content-type', 'application/json; charset=utf-8')
53 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"17"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":17},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
54 .end((err, res) => {
55 res.should.have.status(200)
56 res.body.result.should.be.a('array')
57 res.body.result.should.lengthOf(1)
58 res.body.result[0].should.have.property('id')
59 res.body.result[0].should.have.property('tableRecordId')
60 done()
61 })
62 })
63 })
64
65 context('TEST TRIGGER - SRU - UPDATED', () => {
66 it("should be done successfully.", (done) => {
67 chai.request(SERVER_URL)
68 .post('/api/zapier/execute/32')
69 .set('Authorization', AUTHORIZATION)
70 .set('content-type', 'application/json; charset=utf-8')
71 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"32"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":32},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
72 .end((err, res) => {
73 res.should.have.status(200)
74 res.body.result.should.be.a('array')
75 res.body.result.should.lengthOf(1)
76 res.body.result[0].should.have.property('id')
77 res.body.result[0].should.have.property('tableRecordId')
78 done()
79 })
80 })
81 })
82
83 context('TEST TRIGGER - SRU - DATE', () => {
84 it("should be done successfully.", (done) => {
85 chai.request(SERVER_URL)
86 .post('/api/zapier/execute/58')
87 .set('Authorization', AUTHORIZATION)
88 .set('content-type', 'application/json; charset=utf-8')
89 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"58"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":58},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
90 .end((err, res) => {
91 res.should.have.status(200)
92 res.body.result.should.be.a('array')
93 res.body.result.should.lengthOf(1)
94 res.body.result[0].should.have.property('id')
95 res.body.result[0].should.have.property('tableRecordId')
96 done()
97 })
98 })
99 })
100
101 context('TEST TRIGGER - SRU - FORMULA', () => {
102 it("should be done successfully.", (done) => {
103 chai.request(SERVER_URL)
104 .post('/api/zapier/execute/82')
105 .set('Authorization', AUTHORIZATION)
106 .set('content-type', 'application/json; charset=utf-8')
107 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"82"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":82},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
108 .end((err, res) => {
109 res.should.have.status(200)
110 res.body.result.should.be.a('array')
111 res.body.result.should.lengthOf(1)
112 res.body.result[0].should.have.property('id')
113 res.body.result[0].should.have.property('tableRecordId')
114 done()
115 })
116 })
117 })
118
119 }) // ## Single Record Update
120
121 describe('## Deleting Test Data', () => {
122 updateSingleRecord()
123 deleteMultipleRecords()
124 })
125
126 describe('## Preparing Test Data', () => {
127 for (let i = 0; i < 2; i++) {
128 createSingleRecord()
129 updateSingleRecord()
130 }
131 })
132
133 describe('## Multiple Records Update', () => {
134
135 context('TEST TRIGGER - MRU - CHECKBOX Checked', () => {
136 it("should be done successfully.", (done) => {
137 chai.request(SERVER_URL)
138 .post('/api/zapier/execute/18')
139 .set('Authorization', AUTHORIZATION)
140 .set('content-type', 'application/json; charset=utf-8')
141 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"18"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":18},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
142 .end((err, res) => {
143 res.should.have.status(200)
144 res.body.result.should.be.a('array')
145 res.body.result.should.lengthOf(1)
146 res.body.result[0].should.have.property('id')
147 res.body.result[0].should.have.property('bulk')
148 let bulk = res.body.result[0].bulk
149 bulk.should.be.an('array')
150 bulk.forEach(item => {
151 item.should.have.property('id')
152 item.should.have.property('tableRecordId')
153 })
154 done()
155 })
156 })
157 })
158
159 context('TEST TRIGGER - MRU - CHECKBOX Unchecked', () => {
160 it("should be done successfully.", (done) => {
161 chai.request(SERVER_URL)
162 .post('/api/zapier/execute/19')
163 .set('Authorization', AUTHORIZATION)
164 .set('content-type', 'application/json; charset=utf-8')
165 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"19"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":19},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
166 .end((err, res) => {
167 res.should.have.status(200)
168 res.body.result.should.be.a('array')
169 res.body.result.should.lengthOf(1)
170 res.body.result[0].should.have.property('id')
171 res.body.result[0].should.have.property('bulk')
172 let bulk = res.body.result[0].bulk
173 bulk.should.be.an('array')
174 bulk.forEach(item => {
175 item.should.have.property('id')
176 item.should.have.property('tableRecordId')
177 })
178 done()
179 })
180 })
181 })
182
183 context('TEST TRIGGER - MRU - UPDATED', () => {
184 it("should be done successfully.", (done) => {
185 chai.request(SERVER_URL)
186 .post('/api/zapier/execute/37')
187 .set('Authorization', AUTHORIZATION)
188 .set('content-type', 'application/json; charset=utf-8')
189 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"37"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":37},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
190 .end((err, res) => {
191 res.should.have.status(200)
192 res.body.result.should.be.a('array')
193 res.body.result.should.lengthOf(1)
194 res.body.result[0].should.have.property('id')
195 res.body.result[0].should.have.property('bulk')
196 let bulk = res.body.result[0].bulk
197 bulk.should.be.an('array')
198 bulk.forEach(item => {
199 item.should.have.property('id')
200 item.should.have.property('tableRecordId')
201 })
202 done()
203 })
204 })
205 })
206
207 context('TEST TRIGGER - MRU - DATE', () => {
208 it("should be done successfully.", (done) => {
209 chai.request(SERVER_URL)
210 .post('/api/zapier/execute/69')
211 .set('Authorization', AUTHORIZATION)
212 .set('content-type', 'application/json; charset=utf-8')
213 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"69"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":69},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
214 .end((err, res) => {
215 res.should.have.status(200)
216 res.body.result.should.be.a('array')
217 res.body.result.should.lengthOf(1)
218 res.body.result[0].should.have.property('id')
219 res.body.result[0].should.have.property('bulk')
220 let bulk = res.body.result[0].bulk
221 bulk.should.be.an('array')
222 bulk.forEach(item => {
223 item.should.have.property('id')
224 item.should.have.property('tableRecordId')
225 })
226 done()
227 })
228 })
229 })
230
231 context('TEST TRIGGER - MRU - FORMULA', () => {
232 it("should be done successfully.", (done) => {
233 chai.request(SERVER_URL)
234 .post('/api/zapier/execute/19')
235 .set('Authorization', AUTHORIZATION)
236 .set('content-type', 'application/json; charset=utf-8')
237 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"83"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":83},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
238 .end((err, res) => {
239 res.should.have.status(200)
240 res.body.result.should.be.a('array')
241 res.body.result.should.lengthOf(1)
242 res.body.result[0].should.have.property('id')
243 res.body.result[0].should.have.property('bulk')
244 let bulk = res.body.result[0].bulk
245 bulk.should.be.an('array')
246 bulk.forEach(item => {
247 item.should.have.property('id')
248 item.should.have.property('tableRecordId')
249 })
250 done()
251 })
252 })
253 })
254
255 }) // ## Multiple Records Update
256
257 describe('## Deleting Test Data', () => {
258 for (let i = 0; i < 2; i++) {
259 updateSingleRecord()
260 }
261 deleteMultipleRecords()
262 })
263
264 describe('## Preparing Test Data', () => {
265 createSingleRecord()
266 updateSingleRecord()
267 createSingleRecord()
268 createSingleRecord()
269 createSingleRecord()
270 createSingleRecord()
271 })
272
273 describe('## Single Record To Be Deleted', () => {
274
275 context('TEST TRIGGER - SRD - CHECKBOX - Checked', () => {
276 it("should be done successfully.", (done) => {
277 chai.request(SERVER_URL)
278 .post('/api/zapier/execute/20')
279 .set('Authorization', AUTHORIZATION)
280 .set('content-type', 'application/json; charset=utf-8')
281 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"20"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":20},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
282 .end((err, res) => {
283 res.should.have.status(200)
284 res.body.result.should.be.a('array')
285 res.body.result.should.lengthOf(1)
286 res.body.result[0].should.have.property('id')
287 res.body.result[0].should.have.property('tableRecordId')
288 done()
289 })
290 })
291 })
292
293 context('TEST TRIGGER - SRD - CHECKBOX - Unchecked', () => {
294 it("should be done successfully.", (done) => {
295 chai.request(SERVER_URL)
296 .post('/api/zapier/execute/21')
297 .set('Authorization', AUTHORIZATION)
298 .set('content-type', 'application/json; charset=utf-8')
299 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"21"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":21},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
300 .end((err, res) => {
301 res.should.have.status(200)
302 res.body.result.should.be.a('array')
303 res.body.result.should.lengthOf(1)
304 res.body.result[0].should.have.property('id')
305 res.body.result[0].should.have.property('tableRecordId')
306 done()
307 })
308 })
309 })
310
311 context('TEST TRIGGER - SRD - UPDATED', () => {
312 it("should be done successfully.", (done) => {
313 chai.request(SERVER_URL)
314 .post('/api/zapier/execute/42')
315 .set('Authorization', AUTHORIZATION)
316 .set('content-type', 'application/json; charset=utf-8')
317 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"42"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":42},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
318 .end((err, res) => {
319 res.should.have.status(200)
320 res.body.result.should.be.a('array')
321 res.body.result.should.lengthOf(1)
322 res.body.result[0].should.have.property('id')
323 res.body.result[0].should.have.property('tableRecordId')
324 done()
325 })
326 })
327 })
328
329 context('TEST TRIGGER - SRD - DATE', () => {
330 it("should be done successfully.", (done) => {
331 chai.request(SERVER_URL)
332 .post('/api/zapier/execute/70')
333 .set('Authorization', AUTHORIZATION)
334 .set('content-type', 'application/json; charset=utf-8')
335 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"70"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":70},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
336 .end((err, res) => {
337 res.should.have.status(200)
338 res.body.result.should.be.a('array')
339 res.body.result.should.lengthOf(1)
340 res.body.result[0].should.have.property('id')
341 res.body.result[0].should.have.property('tableRecordId')
342 done()
343 })
344 })
345 })
346
347 context('TEST TRIGGER - SRD - FORMULA', () => {
348 it("should be done successfully.", (done) => {
349 chai.request(SERVER_URL)
350 .post('/api/zapier/execute/84')
351 .set('Authorization', AUTHORIZATION)
352 .set('content-type', 'application/json; charset=utf-8')
353 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"84"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":84},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
354 .end((err, res) => {
355 res.should.have.status(200)
356 res.body.result.should.be.a('array')
357 res.body.result.should.lengthOf(1)
358 res.body.result[0].should.have.property('id')
359 res.body.result[0].should.have.property('tableRecordId')
360 done()
361 })
362 })
363 })
364
365 }) // ## Single Record To Be Deleted
366
367 describe('## Multiple Records To Be Delete', () => {
368
369 describe('## Preparing Test Data', () => {
370 for (let i = 0; i < 2; i++) {
371 createSingleRecord()
372 updateSingleRecord()
373 }
374 })
375
376 context('TEST TRIGGER - MRD - CHECKBOX - Checked', () => {
377 it("should be done successfully.", (done) => {
378 chai.request(SERVER_URL)
379 .post('/api/zapier/execute/22')
380 .set('Authorization', AUTHORIZATION)
381 .set('content-type', 'application/json; charset=utf-8')
382 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"22"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":22},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
383 .end((err, res) => {
384 res.should.have.status(200)
385 res.body.result.should.be.a('array')
386 res.body.result.should.lengthOf(1)
387 res.body.result[0].should.have.property('id')
388 res.body.result[0].should.have.property('bulk')
389 let bulk = res.body.result[0].bulk
390 bulk.should.be.an('array')
391 bulk.forEach(item => {
392 item.should.have.property('id')
393 item.should.have.property('tableRecordId')
394 })
395 done()
396 })
397 })
398 })
399
400 describe('## Preparing Test Data', () => {
401 for (let i = 0; i < 2; i++) {
402 createSingleRecord()
403 }
404 })
405
406 context('TEST TRIGGER - MRD - CHECKBOX - Unchecked', () => {
407 it("should be done successfully.", (done) => {
408 chai.request(SERVER_URL)
409 .post('/api/zapier/execute/24')
410 .set('Authorization', AUTHORIZATION)
411 .set('content-type', 'application/json; charset=utf-8')
412 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"24"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":24},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
413 .end((err, res) => {
414 res.should.have.status(200)
415 res.body.result.should.be.a('array')
416 res.body.result.should.lengthOf(1)
417 res.body.result[0].should.have.property('id')
418 res.body.result[0].should.have.property('bulk')
419 let bulk = res.body.result[0].bulk
420 bulk.should.be.an('array')
421 bulk.forEach(item => {
422 item.should.have.property('id')
423 item.should.have.property('tableRecordId')
424 })
425 done()
426 })
427 })
428 })
429
430 describe('## Preparing Test Data', () => {
431 for (let i = 0; i < 2; i++) {
432 createSingleRecord()
433 }
434 })
435
436 context('TEST TRIGGER - MRD - UPDATED', () => {
437 it("should be done successfully.", (done) => {
438 chai.request(SERVER_URL)
439 .post('/api/zapier/execute/46')
440 .set('Authorization', AUTHORIZATION)
441 .set('content-type', 'application/json; charset=utf-8')
442 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"46"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":46},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
443 .end((err, res) => {
444 res.should.have.status(200)
445 res.body.result.should.be.a('array')
446 res.body.result.should.lengthOf(1)
447 res.body.result[0].should.have.property('id')
448 res.body.result[0].should.have.property('bulk')
449 let bulk = res.body.result[0].bulk
450 bulk.should.be.an('array')
451 bulk.forEach(item => {
452 item.should.have.property('id')
453 item.should.have.property('tableRecordId')
454 })
455 done()
456 })
457 })
458 })
459
460 describe('## Preparing Test Data', () => {
461 for (let i = 0; i < 2; i++) {
462 createSingleRecord()
463 }
464 })
465
466 context('TEST TRIGGER - MRD - DATE', () => {
467 it("should be done successfully.", (done) => {
468 chai.request(SERVER_URL)
469 .post('/api/zapier/execute/81')
470 .set('Authorization', AUTHORIZATION)
471 .set('content-type', 'application/json; charset=utf-8')
472 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"81"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":81},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
473 .end((err, res) => {
474 res.should.have.status(200)
475 res.body.result.should.be.a('array')
476 res.body.result.should.lengthOf(1)
477 res.body.result[0].should.have.property('id')
478 res.body.result[0].should.have.property('bulk')
479 let bulk = res.body.result[0].bulk
480 bulk.should.be.an('array')
481 bulk.forEach(item => {
482 item.should.have.property('id')
483 item.should.have.property('tableRecordId')
484 })
485 done()
486 })
487 })
488 })
489
490 describe('## Preparing Test Data', () => {
491 for (let i = 0; i < 2; i++) {
492 createSingleRecord()
493 }
494 })
495
496 context('TEST TRIGGER - MRD - FORMULA', () => {
497 it("should be done successfully.", (done) => {
498 chai.request(SERVER_URL)
499 .post('/api/zapier/execute/85')
500 .set('Authorization', AUTHORIZATION)
501 .set('content-type', 'application/json; charset=utf-8')
502 .send({"bundle":{"authData":{"apiKey":"qcIHMCh1dOimp4MX","apiKeyObject":{"id":2,"name":"New API Key - Luccas","status":"active","account":10,"user":8,"description":null,"key":"89e929945e220ccb3026537e9918ad2cd8f96ce966a3a51fc64c04007430646e","created_at":"2020-02-02T19:08:38.910Z","updated_at":"2020-02-02T19:08:38.910Z","md5_key":"9e22e377ba2ebb28c0c9a2fa442a1fbb"}},"inputData":{"app_type":"trigger:actions","endpoint":"85"},"inputDataRaw":{"app_type":"trigger:actions","endpoint":85},"meta":{"isLoadingSample":true,"isFillingDynamicDropdown":false,"isTestingAuth":false,"isPopulatingDedupe":false,"limit":3,"page":0}}})
503 .end((err, res) => {
504 res.should.have.status(200)
505 res.body.result.should.be.a('array')
506 res.body.result.should.lengthOf(1)
507 res.body.result[0].should.have.property('id')
508 res.body.result[0].should.have.property('bulk')
509 let bulk = res.body.result[0].bulk
510 bulk.should.be.an('array')
511 bulk.forEach(item => {
512 item.should.have.property('id')
513 item.should.have.property('tableRecordId')
514 })
515 done()
516 })
517 })
518 })
519 }) // ## Multiple Records To Be Delete
520
521}) // # Trigger Test
522