Merge pull request #12525 from mkllnk/fdc-import

Add compatibility to the DFC product import for FDC (Shopify) API
This commit is contained in:
Maikel
2024-06-13 09:51:05 +10:00
committed by GitHub
11 changed files with 569 additions and 19 deletions

View File

@@ -41,4 +41,27 @@ RSpec.describe "DFC Product Import" do
expect(page).to have_content "Importing a DFC product catalog"
expect(page).to have_content "Imported products: 1"
end
it "imports from a FDC catalog", vcr: true do
user.oidc_account.update!(
uid: "testdfc@protonmail.com",
refresh_token: ENV.fetch("OPENID_REFRESH_TOKEN"),
updated_at: 1.day.ago,
)
visit admin_product_import_path
select enterprise.name, from: "Enterprise"
url = "https://food-data-collaboration-produc-fe870152f634.herokuapp.com/fdc/products?shop=test-hodmedod.myshopify.com"
fill_in "catalog_url", with: url
expect {
click_button "Import"
}.to change {
enterprise.supplied_products.count
}
expect(page).to have_content "Importing a DFC product catalog"
end
end