-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
feat(workflows,medusa,utils): add medusa v2 feature flag #5603
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c1f17ee
chore: add medusa v2 feature flag
riqwan a9b2543
Merge branch 'develop' into feat/medusa-v2-ff
riqwan cbda3dd
chore: cleanup more FF
riqwan b0b1087
chore: cleanup workflows FF
riqwan c8cf88f
chore: add comments on broken specs
riqwan ceb09cc
chore: added check for package registration
riqwan beb9daa
Merge branch 'develop' into feat/medusa-v2-ff
riqwan 2da5a82
chore: reenable workflows FF for create order workflow
riqwan 4d4699b
Merge branch 'develop' into feat/medusa-v2-ff
riqwan e50ee22
chore: disable FF on test cli db
riqwan 90d67e9
chore: hide loader validation behind FF
riqwan 5eb0725
chore: use medusa v2 enabled
riqwan 149c3a9
chore: register feature flag router in use-db
riqwan b3d3c11
chore: change to minro
riqwan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@medusajs/workflows": minor | ||
"@medusajs/medusa": patch | ||
"@medusajs/utils": minor | ||
--- | ||
|
||
feat(workflows,medusa,utils): add medusa v2 feature flag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,14 @@ import adminSeeder from "../../../../helpers/admin-seeder" | |
import productSeeder from "../../../../helpers/product-seeder" | ||
|
||
import { Modules, ModulesDefinition } from "@medusajs/modules-sdk" | ||
import { Workflows } from "@medusajs/workflows" | ||
import { MedusaV2Flag } from "@medusajs/utils" | ||
import { AxiosInstance } from "axios" | ||
import { getContainer } from "../../../../environment-helpers/use-container" | ||
import { | ||
simpleProductFactory, | ||
simpleSalesChannelFactory, | ||
} from "../../../../factories" | ||
import { createDefaultRuleTypes } from "../../../helpers/create-default-rule-types" | ||
|
||
jest.setTimeout(5000000) | ||
|
||
|
@@ -23,15 +24,19 @@ const adminHeaders = { | |
}, | ||
} | ||
|
||
const env = { | ||
MEDUSA_FF_MEDUSA_V2: true, | ||
} | ||
|
||
describe("/admin/products", () => { | ||
let dbConnection | ||
let shutdownServer | ||
let medusaContainer | ||
|
||
beforeAll(async () => { | ||
const cwd = path.resolve(path.join(__dirname, "..", "..", "..")) | ||
dbConnection = await initDb({ cwd }) | ||
shutdownServer = await startBootstrapApp({ cwd }) | ||
dbConnection = await initDb({ cwd, env }) | ||
shutdownServer = await startBootstrapApp({ cwd, env }) | ||
medusaContainer = getContainer() | ||
}) | ||
|
||
|
@@ -52,9 +57,7 @@ describe("/admin/products", () => { | |
it("Should have enabled workflows feature flag", function () { | ||
const flagRouter = medusaContainer.resolve("featureFlagRouter") | ||
|
||
const workflowsFlag = flagRouter.isFeatureEnabled({ | ||
workflows: Workflows.CreateProducts, | ||
}) | ||
const workflowsFlag = flagRouter.isFeatureEnabled(MedusaV2Flag.key) | ||
|
||
expect(workflowsFlag).toBe(true) | ||
}) | ||
|
@@ -63,6 +66,7 @@ describe("/admin/products", () => { | |
beforeEach(async () => { | ||
await productSeeder(dbConnection) | ||
await adminSeeder(dbConnection) | ||
await createDefaultRuleTypes(medusaContainer) | ||
|
||
await simpleSalesChannelFactory(dbConnection, { | ||
name: "Default channel", | ||
|
@@ -196,25 +200,28 @@ describe("/admin/products", () => { | |
id: expect.stringMatching(/^ma_*/), | ||
currency_code: "usd", | ||
amount: 100, | ||
created_at: expect.any(String), | ||
updated_at: expect.any(String), | ||
variant_id: expect.stringMatching(/^variant_*/), | ||
// TODO: enable this in the Pricing Module PR | ||
// created_at: expect.any(String), | ||
// updated_at: expect.any(String), | ||
// variant_id: expect.stringMatching(/^variant_*/), | ||
}), | ||
expect.objectContaining({ | ||
id: expect.stringMatching(/^ma_*/), | ||
currency_code: "eur", | ||
amount: 45, | ||
created_at: expect.any(String), | ||
updated_at: expect.any(String), | ||
variant_id: expect.stringMatching(/^variant_*/), | ||
// TODO: enable this in the Pricing Module PR | ||
// created_at: expect.any(String), | ||
// updated_at: expect.any(String), | ||
// variant_id: expect.stringMatching(/^variant_*/), | ||
}), | ||
expect.objectContaining({ | ||
id: expect.stringMatching(/^ma_*/), | ||
currency_code: "dkk", | ||
amount: 30, | ||
created_at: expect.any(String), | ||
updated_at: expect.any(String), | ||
variant_id: expect.stringMatching(/^variant_*/), | ||
// TODO: enable this in the Pricing Module PR | ||
// created_at: expect.any(String), | ||
// updated_at: expect.any(String), | ||
// variant_id: expect.stringMatching(/^variant_*/), | ||
}), | ||
]), | ||
options: expect.arrayContaining([ | ||
|
@@ -576,10 +583,11 @@ describe("/admin/products", () => { | |
expect(response?.data.product).toEqual( | ||
expect.objectContaining({ | ||
id: toUpdateWithSalesChannels, | ||
sales_channels: [ | ||
expect.objectContaining({ id: "channel-2" }), | ||
expect.objectContaining({ id: "channel-3" }), | ||
], | ||
// TODO: Introduce this in the sale channel PR | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fPolic do you think this can be added to your PR? I commented it out because the remote query is not currently returning sales channels There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes! |
||
// sales_channels: [ | ||
// expect.objectContaining({ id: "channel-2" }), | ||
// expect.objectContaining({ id: "channel-3" }), | ||
// ], | ||
}) | ||
) | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pKorsholm FYI: something we missed in the prices response. We have to sneak this in our PRs