Sha256: 388cfe234cec5041c909dd9cc6bdcc51fb47c49417ae1d18fe64bf2bf46bfffd

Contents?: true

Size: 960 Bytes

Versions: 28

Compression:

Stored size: 960 Bytes

Contents

require 'test_helper'

module Workarea
  module Storefront
    class SchemaOrgHelperTest < ViewTest
      include NavigationHelper
      include Engine.routes.url_helpers

      def test_breadcrumb_list_schema
        product = create_product
        category = create_category(product_ids: [product.id]) # so the product will have a parent
        create_taxon(navigable: category)

        view_model = ProductViewModel.wrap(product)
        breadcrumbs = view_model.breadcrumbs.map { |t| [t.name, storefront_url_for(t)] }
        schema = breadcrumb_list_schema(breadcrumbs)
        urls = schema[:itemListElement].map { |e| e[:item][:@id] }
        product_url = storefront.product_url(product, host: Workarea.config.host)

        assert_equal('http://schema.org', schema[:@context])
        assert_equal('BreadcrumbList', schema[:@type])
        assert_equal(product_url, urls.last)
        assert_includes(urls, product_url)
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-storefront-3.5.27 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.26 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.25 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.23 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.22 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.21 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.20 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.19 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.18 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.17 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.16 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.15 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.14 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.13 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.12 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.11 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.10 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.9 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.8 test/helpers/workarea/storefront/schema_org_helper_test.rb
workarea-storefront-3.5.7 test/helpers/workarea/storefront/schema_org_helper_test.rb