Skip to content

Commit

Permalink
Create a test for Export product activities on shopify
Browse files Browse the repository at this point in the history
  • Loading branch information
arfenis committed Sep 13, 2024
1 parent 5bd4e8a commit b81f284
Showing 1 changed file with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

declare(strict_types=1);

namespace Tests\Connectors\Integration\Zoho;

use Kanvas\Apps\Models\Apps;
use Kanvas\Connectors\Shopify\Workflows\Activities\ExportProductToShopifyActivity;
use Kanvas\Inventory\Products\Models\Products;
use Kanvas\Workflow\Models\StoredWorkflow;
use Tests\Connectors\Traits\HasShopifyConfiguration;
use Tests\TestCase;

final class ExportProductToShopifyActivityTest extends TestCase
{
use HasShopifyConfiguration;

public function testExportProductWorkflow(): void
{
$product = Products::first();
$variant = $product->variants()->first();
$warehouse = $variant->warehouses()->first();

$this->setupShopifyIntegration($product, $warehouse->region);

$exportActivity = new ExportProductToShopifyActivity(
0,
now()->toDateTimeString(),
StoredWorkflow::make(),
[]
);

$app = app(Apps::class);

$result = $exportActivity->execute(
product: $product,
app: $app,
params: []
);

//We need to DELETE the exported product after the test.
$this->assertArrayHasKey('shopify_response', $result);
$this->assertArrayHasKey('company', $result);
$this->assertArrayHasKey('product', $result);
}
}

0 comments on commit b81f284

Please sign in to comment.