feat(core-flows,medusa,utils): promotion and campaign create/update endpoint (#6130)

what:

- adds create endpoint for promotions including workflows and endpoint (RESOLVES CORE-1678)
- adds update endpoint for promotions including workflows and endpoint (RESOLVES CORE-1679)
- adds create endpoint for campaigns including workflows and endpoint (RESOLVES CORE-1684)
- adds update endpoint for campaigns including workflows and endpoint (RESOLVES CORE-1685)
This commit is contained in:
Riqwan Thamir
2024-01-22 12:54:17 +01:00
committed by GitHub
parent a52586880c
commit da5cc4cf7f
30 changed files with 1240 additions and 50 deletions

View File

@@ -0,0 +1,62 @@
import { getSelectsAndRelationsFromObjectArray } from "../get-selects-and-relations-from-object-array"
describe("getSelectsAndRelationsFromObjectArray", function () {
it("should return true or false for different types of data", function () {
const expectations = [
{
input: [
{
attr_string: "string",
attr_boolean: true,
attr_null: null,
attr_undefined: undefined,
attr_object: {
attr_string: "string",
attr_boolean: true,
attr_null: null,
attr_undefined: undefined,
},
attr_array: [
{
attr_object: {
attr_string: "string",
attr_boolean: true,
attr_null: null,
attr_undefined: undefined,
},
},
{
attr_object: {
attr_string: "string",
},
},
],
},
],
output: {
selects: [
"attr_string",
"attr_boolean",
"attr_null",
"attr_undefined",
"attr_object.attr_string",
"attr_object.attr_boolean",
"attr_object.attr_null",
"attr_object.attr_undefined",
"attr_array.attr_object.attr_string",
"attr_array.attr_object.attr_boolean",
"attr_array.attr_object.attr_null",
"attr_array.attr_object.attr_undefined",
],
relations: ["attr_object", "attr_array", "attr_array.attr_object"],
},
},
]
expectations.forEach((expectation) => {
expect(getSelectsAndRelationsFromObjectArray(expectation.input)).toEqual(
expectation.output
)
})
})
})