Refactor IdMap test helper to medusa-test-utils package

This commit is contained in:
Sebastian Rindom
2020-01-30 09:54:12 +01:00
parent edce88c34b
commit a912b81426
18 changed files with 2529 additions and 11 deletions
+17
View File
@@ -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