**What** At the moment, when importing something from medusa entry point, if two medusa packages are installed because of a plugin, the evaluation of the import can end up throwing that a workflow is already defined. To prevent that from happening, we can just not throw if it is already defined and just return prematurely and make it idempotent.
34 lines
888 B
TypeScript
34 lines
888 B
TypeScript
import { deepEqualObj } from "../deep-equal-obj"
|
|
|
|
describe("deepEqualObj", function () {
|
|
it("should return true if objects are equal", function () {
|
|
const object1 = {
|
|
foo: "bar",
|
|
bar: "foo",
|
|
xar: { foo: "bar", wor: { bar: "foo", ror: ["test", "test1"] } },
|
|
}
|
|
const object2 = {
|
|
foo: "bar",
|
|
bar: "foo",
|
|
xar: { foo: "bar", wor: { bar: "foo", ror: ["test", "test1"] } },
|
|
}
|
|
|
|
expect(deepEqualObj(object1, object2)).toBe(true)
|
|
})
|
|
|
|
it("should return false if objects are not equal", function () {
|
|
const object1 = {
|
|
foo: "bar",
|
|
bar: "foo",
|
|
xar: { foo: "bar", wor: { bar: "foo", ror: ["test", "test1"] } },
|
|
}
|
|
const object2 = {
|
|
foo: "bar",
|
|
bar: "foo",
|
|
xar: { foo: "bar", wor: { bar: "foo", ror: ["test", "test1_"] } },
|
|
}
|
|
|
|
expect(deepEqualObj(object1, object2)).toBe(false)
|
|
})
|
|
})
|