feat: medusa-react admin hooks (#978)
* add: medusa admin hooks + tests * fix: remove unneeded props * fix: deps * fix: deps * fix: deps * fix: failing tests * fix: failing tests * fix: query key * add: yarn workspaces * fix: linting medusa-react * fix: add prepare script * fix: buildOptions * fix: useAdminShippingOptions query * fix: use qs instead for query params (#1019) * fix: formatting * debug: ci pipeline * debug: log node_modules structure * debug: use lerna bootstrap * debug: update node version * debug: print pkgs in workspace * debug: print pkgs in workspace * debug: print pkgs in workspace * debug: print pkgs in workspace * debug: add explicit build step * fix: jsdoc * debug: run build step * debug: fix build errors * debug: add build step to integration tests * fix: failing test * cleanup Co-authored-by: Sebastian Rindom <seb@medusajs.com> Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
This commit is contained in:
co-authored by
Sebastian Rindom
Sebastian Rindom
parent
24175025d1
commit
2e384842d5
@@ -13,7 +13,7 @@ describe("getVariantPrice", () => {
|
||||
const variant = fixtures.get("product_variant")
|
||||
const region = fixtures.get("region")
|
||||
const amount = getVariantPrice(
|
||||
variant as unknown as ProductVariantInfo,
|
||||
(variant as unknown) as ProductVariantInfo,
|
||||
region
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ describe("getVariantPrice", () => {
|
||||
test("when no region is provided, then it should return 0", () => {
|
||||
const variant = fixtures.get("product_variant")
|
||||
const amount = getVariantPrice(
|
||||
variant as unknown as ProductVariantInfo,
|
||||
(variant as unknown) as ProductVariantInfo,
|
||||
{} as RegionInfo
|
||||
)
|
||||
|
||||
@@ -78,7 +78,7 @@ describe("computeVariantPrice", () => {
|
||||
const variant = fixtures.get("product_variant")
|
||||
const region = fixtures.get("region")
|
||||
const price = computeVariantPrice({
|
||||
variant: variant as unknown as ProductVariantInfo,
|
||||
variant: (variant as unknown) as ProductVariantInfo,
|
||||
region,
|
||||
})
|
||||
|
||||
@@ -89,7 +89,7 @@ describe("computeVariantPrice", () => {
|
||||
const variant = fixtures.get("product_variant")
|
||||
const region = fixtures.get("region")
|
||||
const price = computeVariantPrice({
|
||||
variant: variant as unknown as ProductVariantInfo,
|
||||
variant: (variant as unknown) as ProductVariantInfo,
|
||||
region: {
|
||||
...region,
|
||||
tax_rate: 15,
|
||||
@@ -106,7 +106,7 @@ describe("formatVariantPrice", () => {
|
||||
const region = fixtures.get("region")
|
||||
const variant = fixtures.get("product_variant")
|
||||
const price = formatVariantPrice({
|
||||
variant: variant as unknown as ProductVariantInfo,
|
||||
variant: (variant as unknown) as ProductVariantInfo,
|
||||
region: {
|
||||
...region,
|
||||
tax_rate: 15,
|
||||
@@ -116,26 +116,11 @@ describe("formatVariantPrice", () => {
|
||||
expect(price).toEqual("$11.50")
|
||||
})
|
||||
|
||||
test("given a variant, region, and 1 digit, should return a decimal (1 fraction digit) localized amount including taxes and the region's currency code", () => {
|
||||
const region = fixtures.get("region")
|
||||
const variant = fixtures.get("product_variant")
|
||||
const price = formatVariantPrice({
|
||||
variant: variant as unknown as ProductVariantInfo,
|
||||
region: {
|
||||
...region,
|
||||
tax_rate: 15,
|
||||
},
|
||||
maximumFractionDigits: 1,
|
||||
})
|
||||
|
||||
expect(price).toEqual("$11.5")
|
||||
})
|
||||
|
||||
test("given a variant, region, and a custom locale, should return a decimal localized amount including taxes and the region's currency code", () => {
|
||||
const region = fixtures.get("region")
|
||||
const variant = fixtures.get("product_variant")
|
||||
const price = formatVariantPrice({
|
||||
variant: variant as unknown as ProductVariantInfo,
|
||||
variant: (variant as unknown) as ProductVariantInfo,
|
||||
region: {
|
||||
...region,
|
||||
tax_rate: 15,
|
||||
|
||||
Reference in New Issue
Block a user