Files
medusa-store/packages/medusa-test-utils/src/id-map.js
Sebastian Rindom 96377df101 updates tests
2020-05-25 14:06:10 +02:00

24 lines
385 B
JavaScript

import mongoose from "mongoose"
String.prototype.equals = function(that) {
return this === that
}
class IdMap {
ids = {}
getId(key, backend=false) {
if (this.ids[key]) {
return this.ids[key]
}
const mongooseId = `${mongoose.Types.ObjectId()}`
this.ids[key] = mongooseId
return mongooseId
}
}
const instance = new IdMap()
export default instance