test(repositories): fix mock implementation of thenable query builders in repository tests
Some checks failed
Some checks failed
This commit is contained in:
@@ -20,10 +20,14 @@ describe("ApiKeysRepository", () => {
|
||||
};
|
||||
|
||||
const wrapWithThen = (obj: any) => {
|
||||
obj.then = function (onFulfilled: any) {
|
||||
const result = this.execute();
|
||||
return Promise.resolve(result).then(onFulfilled);
|
||||
};
|
||||
// biome-ignore lint/suspicious/noThenProperty: Necessary to mock Drizzle's awaitable query builder
|
||||
Object.defineProperty(obj, "then", {
|
||||
value: function (onFulfilled: any) {
|
||||
const result = this.execute();
|
||||
return Promise.resolve(result).then(onFulfilled);
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
return obj;
|
||||
};
|
||||
wrapWithThen(mockDb);
|
||||
|
||||
@@ -21,10 +21,14 @@ describe("CategoriesRepository", () => {
|
||||
};
|
||||
|
||||
const wrapWithThen = (obj: any) => {
|
||||
obj.then = function (onFulfilled: any) {
|
||||
const result = this.execute();
|
||||
return Promise.resolve(result).then(onFulfilled);
|
||||
};
|
||||
// biome-ignore lint/suspicious/noThenProperty: Necessary to mock Drizzle's awaitable query builder
|
||||
Object.defineProperty(obj, "then", {
|
||||
value: function (onFulfilled: any) {
|
||||
const result = this.execute();
|
||||
return Promise.resolve(result).then(onFulfilled);
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
return obj;
|
||||
};
|
||||
wrapWithThen(mockDb);
|
||||
|
||||
@@ -20,10 +20,14 @@ describe("FavoritesRepository", () => {
|
||||
};
|
||||
|
||||
const wrapWithThen = (obj: any) => {
|
||||
obj.then = function (onFulfilled: any) {
|
||||
const result = this.execute();
|
||||
return Promise.resolve(result).then(onFulfilled);
|
||||
};
|
||||
// biome-ignore lint/suspicious/noThenProperty: Necessary to mock Drizzle's awaitable query builder
|
||||
Object.defineProperty(obj, "then", {
|
||||
value: function (onFulfilled: any) {
|
||||
const result = this.execute();
|
||||
return Promise.resolve(result).then(onFulfilled);
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
return obj;
|
||||
};
|
||||
wrapWithThen(mockDb);
|
||||
|
||||
@@ -22,10 +22,14 @@ describe("ReportsRepository", () => {
|
||||
};
|
||||
|
||||
const wrapWithThen = (obj: any) => {
|
||||
obj.then = function (onFulfilled: any) {
|
||||
const result = this.execute();
|
||||
return Promise.resolve(result).then(onFulfilled);
|
||||
};
|
||||
// biome-ignore lint/suspicious/noThenProperty: Necessary to mock Drizzle's awaitable query builder
|
||||
Object.defineProperty(obj, "then", {
|
||||
value: function (onFulfilled: any) {
|
||||
const result = this.execute();
|
||||
return Promise.resolve(result).then(onFulfilled);
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
return obj;
|
||||
};
|
||||
wrapWithThen(mockDb);
|
||||
|
||||
Reference in New Issue
Block a user