zapier improvements (#532)

* zapier improvements

* Fix test case

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Chirag Chhatrala
2024-08-19 19:04:01 +05:30
committed by GitHub
parent 7ac8503201
commit 943e906c86
7 changed files with 18 additions and 23 deletions

View File

@@ -23,7 +23,7 @@ test('create an integration', function () {
$this->withoutExceptionHandling();
post(route('zapier.webhooks.store'), [
'form_id' => $form->slug,
'form_id' => $form->id,
'hookUrl' => $hookUrl = 'https://zapier.com/hook/test'
])
->assertOk();
@@ -45,7 +45,7 @@ test('cannot create an integration without a corresponding ability', function ()
Sanctum::actingAs($user);
post(route('zapier.webhooks.store'), [
'form_id' => $form->slug,
'form_id' => $form->id,
'hookUrl' => 'https://zapier.com/hook/test'
])
->assertForbidden();
@@ -64,7 +64,7 @@ test('cannot create an integration for other users form', function () {
Sanctum::actingAs($user);
post(route('zapier.webhooks.store'), [
'form_id' => $form->slug,
'form_id' => $form->id,
'hookUrl' => 'https://zapier.com/hook/test'
])
->assertForbidden();
@@ -94,7 +94,7 @@ test('delete an integration', function () {
assertDatabaseCount('form_integrations', 1);
delete(route('zapier.webhooks.destroy', $integration), [
'form_id' => $form->slug,
'form_id' => $form->id,
'hookUrl' => $hookUrl,
])
->assertOk();
@@ -122,7 +122,7 @@ test('cannot delete an integration with an incorrect hook url', function () {
]);
delete(route('zapier.webhooks.destroy', $integration), [
'form_id' => $form->slug,
'form_id' => $form->id,
'hookUrl' => 'https://google.com',
])
->assertOk();
@@ -178,7 +178,7 @@ test('poll for the latest submission', function () {
Sanctum::actingAs($user, ['view', 'manage-integrations']);
// Call the poll endpoint
$response = $this->getJson(route('zapier.webhooks.poll', ['form_id' => $form->slug]));
$response = $this->getJson(route('zapier.webhooks.poll', ['form_id' => $form->id]));
// Assert the response status is OK
$response->assertOk();
@@ -229,7 +229,7 @@ test('make up a submission when polling without any submission', function () {
// Call the poll endpoint
$this->withoutExceptionHandling();
$response = $this->getJson(route('zapier.webhooks.poll', ['form_id' => $form->slug]));
$response = $this->getJson(route('zapier.webhooks.poll', ['form_id' => $form->id]));
// Assert the response status is OK
$response->assertOk();

View File

@@ -22,11 +22,11 @@ test('list all forms of a given workspace', function () {
->assertJsonCount(2)
->assertJson([
[
'id' => $form1->slug,
'id' => $form1->id,
'name' => $form1->title,
],
[
'id' => $form2->slug,
'id' => $form2->id,
'name' => $form2->title,
],
]);