Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Add test for clearing selection

Matthew Kennedy829ba37dfca0
diff --git a/core/spec/models/spree/menu_item_spec.rb b/core/spec/models/spree/menu_item_spec.rb
index f523ef6b0e..7b4d8b2ad1 100644
--- a/core/spec/models/spree/menu_item_spec.rb
+++ b/core/spec/models/spree/menu_item_spec.rb
@@ -98,12 +98,26 @@ describe Spree::MenuItem, type: :model do
expect(item_taxon.destination).to eql "/t/#{taxon.permalink}"
end
+ it 'returns nil for destination when taxon is removed' do
+ item_taxon.update(linked_resource_id: taxon.id)
+ item_taxon.update(linked_resource_id: nil)
+
+ expect(item_taxon.destination).to eql nil
+ end
+
it 'returns product path' do
item_product.update(linked_resource_id: product.id)
expect(item_product.destination).to eql "/products/#{product.slug}"
end
+ it 'returns nil for destination when product is removed' do
+ item_product.update(linked_resource_id: product.id)
+ item_product.update(linked_resource_id: nil)
+
+ expect(item_product.destination).to eql nil
+ end
+
it 'returns root path' do
expect(item_home.destination).to eql '/'
end