Files
medusa-store/packages/medusa-test-utils/src/mock-manager.js
2023-03-31 13:09:57 +02:00

32 lines
527 B
JavaScript

export default {
connection: {
getMetadata: (target) => {
return (
target["metadata"] ?? {
columns: [],
}
)
},
},
getRepository: function (repo) {
return repo
},
withRepository: function (repo) {
if (repo) {
return Object.assign(repo, { manager: this })
}
return repo
},
transaction: function (isolationOrCb, cb) {
if (typeof isolationOrCb === "string") {
return cb(this)
} else {
return isolationOrCb(this)
}
},
}