Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Shopify] - Add Item As Variant Tests #4

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

petemchlk
Copy link
Collaborator

Add Item As Variant Test

Automated tests for changes microsoft#26712

@petemchlk petemchlk requested a review from tinestaric October 21, 2024 10:42
@@ -0,0 +1,130 @@
codeunit 139581 "Shpfy Create Item Variant Test"
Copy link
Collaborator

@tinestaric tinestaric Oct 21, 2024

Choose a reason for hiding this comment

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

I'm not sure what the agreement is on how thorough the tests should be. I see you're mainly doing unit tests on a level of a procedure. I'd also like to see a tests or two that handle the cases where Option > 1 and one for removing the default variant.

VariantAPI: Codeunit "Shpfy Variant API";
VariantId: BigInteger;
ActualQueryTxt: Text;
ExpexctedQueryTok: Label '{"query":"mutation {productVariantDelete(id: \"gid://shopify/ProductVariant/%1\") {deletedProductVariantId userErrors{field message}}}"}', Locked = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

In this case, it's fine. as it's a small query, but I feel we'd be breaking these kinds of tests over time, as we change the queries in the actual app.

It might be better to only assert if the part of the query that you really care about is in it?
Like, you care that it contains productVariantDelete and your id, but you don't really care too much about the rest...

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.

2 participants