Skip to content

Conversation

@lopert
Copy link
Contributor

@lopert lopert commented Dec 4, 2025

Background

Fixes https://github.com/shop/issues-shopifyvm/issues/765
Converts existing unit tests to integration tests instead.

Also covers the rust side of https://github.com/shop/issues-shopifyvm/issues/755

Solution

Create a fixture representing each of the existing unit test scenarios.

Tophat

Run the generate command targetting this branch

shopify app generate extension -u https://github.com/Shopify/extensions-templates.git/\#lopert.convert-function-unit-tests

Checklist

  • I have 🎩'd these changes
 ~/code/functions/dec-npm-rr-js  main ?24  npx vitest run

 RUN  v3.2.4 /Users/lopert/code/functions/dec-npm-rr-js

 ✓ extensions/cart-transformer/tests/default.test.js (1 test) 15501ms
 ✓ extensions/fulfillment-constraints/tests/default.test.js (1 test) 15565ms
 ✓ extensions/order-discount/tests/default.test.js (1 test) 15620ms
 ✓ extensions/discounts-allocator/tests/default.test.js (1 test) 15627ms
 ✓ extensions/cart-checkout-validation/tests/default.test.js (2 tests) 15822ms
 ✓ extensions/product-discount/tests/default.test.js (1 test) 16172ms
 ✓ extensions/discount-function/tests/default.test.js (8 tests) 16332ms
 ✓ extensions/payment-customization/tests/default.test.js (1 test) 16461ms
 ✓ extensions/delivery-customization/tests/default.test.js (1 test) 16606ms
 ✓ extensions/local-pickup-delivery-option-generators/tests/default.test.js (1 test) 16633ms
 ✓ extensions/shipping-discount/tests/default.test.js (1 test) 6212ms
 ✓ extensions/order-routing-location-rule/tests/default.test.js (1 test) 6466ms
 ✓ extensions/pickup-point-delivery-option-generators/tests/default.test.js (5 tests) 6448ms

 Test Files  13 passed (13)
      Tests  25 passed (25)
   Start at  17:00:41
   Duration  23.47s (transform 85ms, setup 0ms, collect 2.21s, tests 179.47s, environment 1ms, prepare 1.24s)
  • I have squashed my commits into chunks of work with meaningful commit messages

@lopert lopert force-pushed the lopert.convert-function-unit-tests branch from def4c79 to 73c2971 Compare December 4, 2025 20:46
@lopert lopert marked this pull request as ready for review December 5, 2025 14:01
Copy link

@saga-dasgupta saga-dasgupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you haven't removed the rust unit tests.

@lopert lopert requested a review from achitojha December 8, 2025 20:21
Copy link

@saga-dasgupta saga-dasgupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and verified that all the unit tests have been replaced by fixtures and all the fixtures pass for cart validation, cart transform, delivery customization, discount and discount allocator functions for both Rust and JS.

Copy link
Contributor

@achitojha achitojha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified all extension tests succeed and use the respective json files for Rust & Javascript versions of "Fulfillment constraint" / "Local pickup delivery option generator" / "Pickup point delivery option generator" / "Payment customization"

@lopert lopert merged commit dd421ed into main Dec 10, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants