chore: Merge master to develop and manage conflict (#3570)
This commit is contained in:
@@ -1,9 +1,22 @@
|
||||
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
|
||||
},
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ class MockRepo {
|
||||
del,
|
||||
count,
|
||||
insertBulk,
|
||||
metadata
|
||||
}) {
|
||||
this.create_ = create
|
||||
this.update_ = update
|
||||
@@ -28,6 +29,10 @@ class MockRepo {
|
||||
this.findAndCount_ = findAndCount
|
||||
this.findOneWithRelations_ = findOneWithRelations
|
||||
this.insertBulk_ = insertBulk
|
||||
|
||||
this.metadata = metadata ?? {
|
||||
columns: []
|
||||
}
|
||||
}
|
||||
|
||||
setFindOne(fn) {
|
||||
@@ -83,11 +88,22 @@ class MockRepo {
|
||||
return this.findDescendantsTree_(...args)
|
||||
}
|
||||
})
|
||||
findOneOrFail = jest.fn().mockImplementation((...args) => {
|
||||
if (this.findOneOrFail_) {
|
||||
return this.findOneOrFail_(...args)
|
||||
}
|
||||
})
|
||||
|
||||
find = jest.fn().mockImplementation((...args) => {
|
||||
if (this.find_) {
|
||||
return this.find_(...args)
|
||||
}
|
||||
})
|
||||
softRemove = jest.fn().mockImplementation((...args) => {
|
||||
if (this.softRemove_) {
|
||||
return this.softRemove_(...args)
|
||||
}
|
||||
})
|
||||
save = jest.fn().mockImplementation((...args) => {
|
||||
if (this.save_) {
|
||||
return this.save_(...args)
|
||||
@@ -107,6 +123,7 @@ class MockRepo {
|
||||
}
|
||||
return {}
|
||||
})
|
||||
|
||||
delete = jest.fn().mockImplementation((...args) => {
|
||||
if (this.delete_) {
|
||||
return this.delete_(...args)
|
||||
|
||||
Reference in New Issue
Block a user