Refactor IdMap test helper to medusa-test-utils package
This commit is contained in:
1 parent
edce88c34b
commit
a912b81426
18 files changed
+2529
-11
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import mongoose from "mongoose"
|
||||
|
||||
class IdMap {
|
||||
ids = {}
|
||||
|
||||
getId(key) {
|
||||
if (this.ids[key]) {
|
||||
return this.ids[key]
|
||||
}
|
||||
const id = `${mongoose.Types.ObjectId()}`
|
||||
this.ids[key] = id
|
||||
return id
|
||||
}
|
||||
}
|
||||
|
||||
const instance = new IdMap()
|
||||
export default instance
|
||||
@@ -0,0 +1 @@
|
||||
export { default as IdMap } from "./id-map"
|
||||
Reference in new issue
Block a user