Create mocks for the entire Customer Account extension API#3905
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
8c15ddb to
4a0e80d
Compare
3e06b36 to
072992f
Compare
4a0e80d to
27fe3a8
Compare
072992f to
34763c2
Compare
27fe3a8 to
8fccf50
Compare
34763c2 to
c11b76b
Compare
8fccf50 to
b6b83e9
Compare
c11b76b to
bb5b1ed
Compare
bab7729 to
a303042
Compare
344b671 to
af00386
Compare
a303042 to
2db9df6
Compare
af00386 to
7049f9e
Compare
6e15cd7 to
83b81e0
Compare
7049f9e to
1a6144c
Compare
83b81e0 to
69f7238
Compare
1a6144c to
62487cd
Compare
69f7238 to
bb90420
Compare
62487cd to
4fd668d
Compare
bb90420 to
9707ec1
Compare
4fd668d to
d8892b1
Compare
9707ec1 to
2b029e3
Compare
6a6278e to
62257f8
Compare
6e71146 to
72c73f2
Compare
62257f8 to
a032d27
Compare
f40aec8 to
c54d277
Compare
d589fc4 to
5efb512
Compare
c54d277 to
ce20b48
Compare
5efb512 to
85f54b7
Compare
302e58c to
f89ddc2
Compare
a3b1741 to
d44f1a8
Compare
f89ddc2 to
698b63c
Compare
d44f1a8 to
52fb875
Compare
698b63c to
0e206f6
Compare
52fb875 to
ce1d887
Compare
|
|
||
| const customerAccountMockFactories: CustomerAccountMockFactory = { | ||
| // StandardApi only | ||
| 'customer-account.page.render': createStandardApiProperties, |
There was a problem hiding this comment.
Should we also add the navigation api? https://shopify.dev/docs/api/customer-account-ui-extensions/latest/apis/navigation
navigate is available in all targets, full page extensions have more properties available
There was a problem hiding this comment.
oh yeah. Is this available for Admin, too? I can't tell.
There was a problem hiding this comment.
I added a mock for all surfaces (on the base branch). Good call, thanks!
There was a problem hiding this comment.
Why all surfaces? 😅 Checkout doesn't have it, right?
There was a problem hiding this comment.
if at least two surfaces include it then I think it's good to include it everywhere. We could make navigate() throw an error if the extension under test is in an unsupported target.
There was a problem hiding this comment.
POS implements the same navigation API. It should share the type but that's for another day. https://github.com/Shopify/ui-extensions/blob/2026-04-rc/packages/ui-extensions/src/surfaces/point-of-sale/api/navigation-api/navigation-api.ts
|
Tried to run tests, but it failed to resolve the package. |
|
Hmm, this is working for me. Is this what you did? |
ah nope, didn't run the |
|
Not sure if expected, after running yarn, I have diff in the yarn.lock diff --git a/yarn.lock b/yarn.lock
index ecd4402ac..9094c8db4 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2024,6 +2024,13 @@
resolved "https://registry.npmjs.org/@shopify/typescript-configs/-/typescript-configs-5.1.0.tgz"
integrity sha512-RywGBTR+nQyJLxcrUcihPkHPIG3pIQI6i0YwMrM5rs9nWJ0+9A5HKEcboyGPLH+8V08EXGfFQ6H820O9ajyk4A==
+"@shopify/ui-extensions@*":
+ version "2026.1.2"
+ resolved "https://npm.shopify.io/node/@shopify/ui-extensions/-/ui-extensions-2026.1.2.tgz#2599a6bf6063640f467a3c3ff2ab80afbd2de9d0"
+ integrity sha512-lngck7uPBcpMrL36cw/7NJCBsagIleB6dw/hrxEtW600PdPoOUoUyhOnsjM4J5NCheNGD4Ar2h/a0zh2ki9QXw==
+ dependencies:
+ ts-morph "^25.0.1"
+
"@sinclair/typebox@^0.24.1":
version "0.24.51"
resolved "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.51.tgz" |
|
@kumar303 why did you choose to have all those examples be packages that use npm and handle their own locks etc? Why not make them part of the workspaces for easier dependency management? |
|
I updated all the example readmes to specify the build step. As for |
probably no good reason. I didn't think I could make nested example directories part of the workspace. |
|
and yarn is weird |
robin-drexler
left a comment
There was a problem hiding this comment.
This is amazing. I haven't (yet) looked into how the sausage is made exactly, but the test experience looks good at a glance!
| ); | ||
|
|
||
| beforeEach(() => { | ||
| extension.setUp(); |
There was a problem hiding this comment.
because that's not grammatically correct? 😅 The imperative verb tense is set up and in noun form it would be setup. Forgive me for being pedantic, sorry; I just need the illusion of control in my life sometimes.
andrewmcgov
left a comment
There was a problem hiding this comment.
Nice work @kumar303 this will be a huge win for extension devs. Very excited about this.
Was able to test it out successfully:
| function createMoney(): Money { | ||
| return {amount: 0, currencyCode: 'USD' as const}; | ||
| } |
There was a problem hiding this comment.
Not a huge deal but createMoney is defined twice, here and in packages/ui-extensions-tester/src/customer-account/index.ts Probably only need one of them?

Follow up to #3899 that adds a complete, type-safe mock of the Customer Account extension API
👁️ How to review this PR