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) => {
|
const wrapWithThen = (obj: any) => {
|
||||||
obj.then = function (onFulfilled: any) {
|
// biome-ignore lint/suspicious/noThenProperty: Necessary to mock Drizzle's awaitable query builder
|
||||||
const result = this.execute();
|
Object.defineProperty(obj, "then", {
|
||||||
return Promise.resolve(result).then(onFulfilled);
|
value: function (onFulfilled: any) {
|
||||||
};
|
const result = this.execute();
|
||||||
|
return Promise.resolve(result).then(onFulfilled);
|
||||||
|
},
|
||||||
|
configurable: true,
|
||||||
|
});
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
wrapWithThen(mockDb);
|
wrapWithThen(mockDb);
|
||||||
|
|||||||
@@ -21,10 +21,14 @@ describe("CategoriesRepository", () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const wrapWithThen = (obj: any) => {
|
const wrapWithThen = (obj: any) => {
|
||||||
obj.then = function (onFulfilled: any) {
|
// biome-ignore lint/suspicious/noThenProperty: Necessary to mock Drizzle's awaitable query builder
|
||||||
const result = this.execute();
|
Object.defineProperty(obj, "then", {
|
||||||
return Promise.resolve(result).then(onFulfilled);
|
value: function (onFulfilled: any) {
|
||||||
};
|
const result = this.execute();
|
||||||
|
return Promise.resolve(result).then(onFulfilled);
|
||||||
|
},
|
||||||
|
configurable: true,
|
||||||
|
});
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
wrapWithThen(mockDb);
|
wrapWithThen(mockDb);
|
||||||
|
|||||||
@@ -20,10 +20,14 @@ describe("FavoritesRepository", () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const wrapWithThen = (obj: any) => {
|
const wrapWithThen = (obj: any) => {
|
||||||
obj.then = function (onFulfilled: any) {
|
// biome-ignore lint/suspicious/noThenProperty: Necessary to mock Drizzle's awaitable query builder
|
||||||
const result = this.execute();
|
Object.defineProperty(obj, "then", {
|
||||||
return Promise.resolve(result).then(onFulfilled);
|
value: function (onFulfilled: any) {
|
||||||
};
|
const result = this.execute();
|
||||||
|
return Promise.resolve(result).then(onFulfilled);
|
||||||
|
},
|
||||||
|
configurable: true,
|
||||||
|
});
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
wrapWithThen(mockDb);
|
wrapWithThen(mockDb);
|
||||||
|
|||||||
@@ -22,10 +22,14 @@ describe("ReportsRepository", () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const wrapWithThen = (obj: any) => {
|
const wrapWithThen = (obj: any) => {
|
||||||
obj.then = function (onFulfilled: any) {
|
// biome-ignore lint/suspicious/noThenProperty: Necessary to mock Drizzle's awaitable query builder
|
||||||
const result = this.execute();
|
Object.defineProperty(obj, "then", {
|
||||||
return Promise.resolve(result).then(onFulfilled);
|
value: function (onFulfilled: any) {
|
||||||
};
|
const result = this.execute();
|
||||||
|
return Promise.resolve(result).then(onFulfilled);
|
||||||
|
},
|
||||||
|
configurable: true,
|
||||||
|
});
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
wrapWithThen(mockDb);
|
wrapWithThen(mockDb);
|
||||||
|
|||||||
Reference in New Issue
Block a user