chore(feature-flags): Sales Channels enabled by default (#2966)
This commit is contained in:
@@ -47,7 +47,7 @@ Object {
|
||||
"status": "draft",
|
||||
"subtitle": null,
|
||||
"thumbnail": null,
|
||||
"title": "Practical Frozen Fish",
|
||||
"title": "Handmade Frozen Chair",
|
||||
"type_id": Any<String>,
|
||||
"updated_at": Any<String>,
|
||||
"weight": null,
|
||||
|
||||
@@ -33,6 +33,7 @@ Array [
|
||||
],
|
||||
"origin_country": null,
|
||||
"profile_id": StringMatching /\\^sp_\\*/,
|
||||
"sales_channels": Array [],
|
||||
"status": "draft",
|
||||
"subtitle": null,
|
||||
"tags": Array [],
|
||||
@@ -174,6 +175,7 @@ Object {
|
||||
],
|
||||
"origin_country": null,
|
||||
"profile_id": StringMatching /\\^sp_\\*/,
|
||||
"sales_channels": Array [],
|
||||
"status": "draft",
|
||||
"subtitle": null,
|
||||
"tags": Array [
|
||||
@@ -351,6 +353,7 @@ Object {
|
||||
],
|
||||
"origin_country": null,
|
||||
"profile_id": StringMatching /\\^sp_\\*/,
|
||||
"sales_channels": Array [],
|
||||
"status": "published",
|
||||
"subtitle": null,
|
||||
"tags": Array [
|
||||
|
||||
@@ -32,34 +32,6 @@ Object {
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`sales channels GET /admin/sales-channels should list the sales channel 1`] = `
|
||||
Object {
|
||||
"count": 2,
|
||||
"limit": 20,
|
||||
"offset": 0,
|
||||
"sales_channels": ArrayContaining [
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"description": "test description",
|
||||
"id": Any<String>,
|
||||
"is_disabled": false,
|
||||
"name": "test name",
|
||||
"updated_at": Any<String>,
|
||||
},
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"description": "test description 2",
|
||||
"id": Any<String>,
|
||||
"is_disabled": false,
|
||||
"name": "test name 2",
|
||||
"updated_at": Any<String>,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`sales channels GET /admin/sales-channels should list the sales channel using free text search 1`] = `
|
||||
Object {
|
||||
"count": 1,
|
||||
|
||||
@@ -6,145 +6,3 @@ Object {
|
||||
"type": "invalid_data",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`/admin/store POST /admin/store successfully updates and store currencies 1`] = `
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"currencies": Array [
|
||||
Object {
|
||||
"code": "jpy",
|
||||
"name": "Japanese Yen",
|
||||
"symbol": "¥",
|
||||
"symbol_native": "¥",
|
||||
},
|
||||
Object {
|
||||
"code": "usd",
|
||||
"name": "US Dollar",
|
||||
"symbol": "$",
|
||||
"symbol_native": "$",
|
||||
},
|
||||
],
|
||||
"default_currency_code": "usd",
|
||||
"default_location_id": null,
|
||||
"id": Any<String>,
|
||||
"invite_link_template": null,
|
||||
"metadata": null,
|
||||
"name": "Medusa Store",
|
||||
"payment_link_template": null,
|
||||
"swap_link_template": null,
|
||||
"updated_at": Any<String>,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`/admin/store POST /admin/store successfully updates default currency and store currencies 1`] = `
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"currencies": Array [
|
||||
Object {
|
||||
"code": "jpy",
|
||||
"name": "Japanese Yen",
|
||||
"symbol": "¥",
|
||||
"symbol_native": "¥",
|
||||
},
|
||||
Object {
|
||||
"code": "usd",
|
||||
"name": "US Dollar",
|
||||
"symbol": "$",
|
||||
"symbol_native": "$",
|
||||
},
|
||||
],
|
||||
"default_currency": Object {
|
||||
"code": "jpy",
|
||||
"name": "Japanese Yen",
|
||||
"symbol": "¥",
|
||||
"symbol_native": "¥",
|
||||
},
|
||||
"default_currency_code": "jpy",
|
||||
"default_location_id": null,
|
||||
"id": Any<String>,
|
||||
"invite_link_template": null,
|
||||
"metadata": null,
|
||||
"name": "Medusa Store",
|
||||
"payment_link_template": null,
|
||||
"swap_link_template": null,
|
||||
"updated_at": Any<String>,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`/admin/store POST /admin/store successfully updates default currency code 1`] = `
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"currencies": Array [
|
||||
Object {
|
||||
"code": "usd",
|
||||
"name": "US Dollar",
|
||||
"symbol": "$",
|
||||
"symbol_native": "$",
|
||||
},
|
||||
Object {
|
||||
"code": "dkk",
|
||||
"name": "Danish Krone",
|
||||
"symbol": "Dkr",
|
||||
"symbol_native": "kr",
|
||||
},
|
||||
],
|
||||
"default_currency": Object {
|
||||
"code": "dkk",
|
||||
"name": "Danish Krone",
|
||||
"symbol": "Dkr",
|
||||
"symbol_native": "kr",
|
||||
},
|
||||
"default_currency_code": "dkk",
|
||||
"default_location_id": null,
|
||||
"id": Any<String>,
|
||||
"invite_link_template": null,
|
||||
"metadata": null,
|
||||
"name": "Medusa Store",
|
||||
"payment_link_template": null,
|
||||
"swap_link_template": null,
|
||||
"updated_at": Any<String>,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`/admin/store Store creation has created store with default currency 1`] = `
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"currencies": Array [
|
||||
Object {
|
||||
"code": "usd",
|
||||
"name": "US Dollar",
|
||||
"symbol": "$",
|
||||
"symbol_native": "$",
|
||||
},
|
||||
],
|
||||
"default_currency": Object {
|
||||
"code": "usd",
|
||||
"name": "US Dollar",
|
||||
"symbol": "$",
|
||||
"symbol_native": "$",
|
||||
},
|
||||
"default_currency_code": "usd",
|
||||
"default_location_id": null,
|
||||
"feature_flags": Any<Array>,
|
||||
"fulfillment_providers": Array [
|
||||
Object {
|
||||
"id": "test-ful",
|
||||
"is_installed": true,
|
||||
},
|
||||
],
|
||||
"id": Any<String>,
|
||||
"invite_link_template": null,
|
||||
"metadata": null,
|
||||
"modules": Any<Array>,
|
||||
"name": "Medusa Store",
|
||||
"payment_link_template": null,
|
||||
"payment_providers": Array [
|
||||
Object {
|
||||
"id": "test-pay",
|
||||
"is_installed": true,
|
||||
},
|
||||
],
|
||||
"swap_link_template": null,
|
||||
"updated_at": Any<String>,
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -12,7 +12,10 @@ const {
|
||||
DiscountConditionOperator,
|
||||
} = require("@medusajs/medusa")
|
||||
const { IdMap } = require("medusa-test-utils")
|
||||
const { simpleDiscountFactory } = require("../../factories")
|
||||
const {
|
||||
simpleDiscountFactory,
|
||||
simpleSalesChannelFactory,
|
||||
} = require("../../factories")
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
|
||||
@@ -109,31 +109,20 @@ describe("sales channels", () => {
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.sales_channels).toBeTruthy()
|
||||
expect(response.data.sales_channels.length).toBe(2)
|
||||
expect(response.data).toMatchSnapshot({
|
||||
count: 2,
|
||||
limit: 20,
|
||||
offset: 0,
|
||||
sales_channels: expect.arrayContaining([
|
||||
{
|
||||
id: expect.any(String),
|
||||
name: salesChannel1.name,
|
||||
description: salesChannel1.description,
|
||||
is_disabled: false,
|
||||
deleted_at: null,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
name: salesChannel2.name,
|
||||
description: salesChannel2.description,
|
||||
is_disabled: false,
|
||||
deleted_at: null,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
]),
|
||||
})
|
||||
expect(response.data).toEqual(
|
||||
expect.objectContaining({
|
||||
sales_channels: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
name: salesChannel1.name,
|
||||
description: salesChannel1.description,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
name: salesChannel2.name,
|
||||
description: salesChannel2.description,
|
||||
}),
|
||||
]),
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it("should list the sales channel using free text search", async () => {
|
||||
@@ -632,7 +621,7 @@ describe("sales channels", () => {
|
||||
relations: ["sales_channels"],
|
||||
})
|
||||
|
||||
expect(attachedProduct.sales_channels.length).toBe(1)
|
||||
expect(attachedProduct.sales_channels.length).toBe(2)
|
||||
expect(attachedProduct.sales_channels).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
@@ -641,6 +630,10 @@ describe("sales channels", () => {
|
||||
description: "test description",
|
||||
is_disabled: false,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
is_disabled: false,
|
||||
}),
|
||||
])
|
||||
)
|
||||
|
||||
@@ -679,7 +672,8 @@ describe("sales channels", () => {
|
||||
relations: ["sales_channels"],
|
||||
})
|
||||
|
||||
expect(attachedProduct.sales_channels.length).toBe(0)
|
||||
// default sales channel
|
||||
expect(attachedProduct.sales_channels.length).toBe(1)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -733,7 +727,8 @@ describe("sales channels", () => {
|
||||
relations: ["sales_channels"],
|
||||
})
|
||||
|
||||
expect(attachedProduct.sales_channels.length).toBe(1)
|
||||
// + default sales channel
|
||||
expect(attachedProduct.sales_channels.length).toBe(2)
|
||||
expect(attachedProduct.sales_channels).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
@@ -742,6 +737,10 @@ describe("sales channels", () => {
|
||||
description: "test description",
|
||||
is_disabled: false,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
is_disabled: false,
|
||||
}),
|
||||
])
|
||||
)
|
||||
})
|
||||
|
||||
@@ -44,20 +44,26 @@ describe("/admin/store", () => {
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.store).toMatchSnapshot({
|
||||
id: expect.any(String),
|
||||
name: "Medusa Store",
|
||||
currencies: [
|
||||
{
|
||||
code: "usd",
|
||||
},
|
||||
],
|
||||
modules: expect.any(Array),
|
||||
feature_flags: expect.any(Array),
|
||||
default_currency_code: "usd",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
})
|
||||
expect(response.data.store).toEqual(
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
default_sales_channel_id: expect.any(String),
|
||||
default_sales_channel: expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
}),
|
||||
name: "Medusa Store",
|
||||
currencies: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
code: "usd",
|
||||
}),
|
||||
]),
|
||||
modules: expect.any(Array),
|
||||
feature_flags: expect.any(Array),
|
||||
default_currency_code: "usd",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
})
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -142,21 +148,24 @@ describe("/admin/store", () => {
|
||||
.catch((err) => console.log(err))
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.store).toMatchSnapshot({
|
||||
id: expect.any(String),
|
||||
name: "Medusa Store",
|
||||
currencies: [
|
||||
{
|
||||
code: "usd",
|
||||
},
|
||||
{
|
||||
code: "dkk",
|
||||
},
|
||||
],
|
||||
default_currency_code: "dkk",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
})
|
||||
expect(response.data.store).toEqual(
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
name: "Medusa Store",
|
||||
default_sales_channel_id: expect.any(String),
|
||||
currencies: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
code: "usd",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
code: "dkk",
|
||||
}),
|
||||
]),
|
||||
default_currency_code: "dkk",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it("successfully updates default currency and store currencies", async () => {
|
||||
@@ -174,21 +183,24 @@ describe("/admin/store", () => {
|
||||
)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.store).toMatchSnapshot({
|
||||
id: expect.any(String),
|
||||
name: "Medusa Store",
|
||||
currencies: [
|
||||
{
|
||||
code: "jpy",
|
||||
},
|
||||
{
|
||||
code: "usd",
|
||||
},
|
||||
],
|
||||
default_currency_code: "jpy",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
})
|
||||
expect(response.data.store).toEqual(
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
name: "Medusa Store",
|
||||
default_sales_channel_id: expect.any(String),
|
||||
currencies: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
code: "jpy",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
code: "usd",
|
||||
}),
|
||||
]),
|
||||
default_currency_code: "jpy",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it("successfully updates and store currencies", async () => {
|
||||
@@ -205,21 +217,24 @@ describe("/admin/store", () => {
|
||||
)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.store).toMatchSnapshot({
|
||||
id: expect.any(String),
|
||||
name: "Medusa Store",
|
||||
currencies: [
|
||||
{
|
||||
code: "jpy",
|
||||
},
|
||||
{
|
||||
code: "usd",
|
||||
},
|
||||
],
|
||||
default_currency_code: "usd",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
})
|
||||
expect(response.data.store).toEqual(
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
default_sales_channel_id: expect.any(String),
|
||||
name: "Medusa Store",
|
||||
currencies: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
code: "jpy",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
code: "usd",
|
||||
}),
|
||||
]),
|
||||
default_currency_code: "usd",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
})
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user