2022-05-08 01:36:22 +00:00
|
|
|
import pg from "../postgres.js";
|
|
|
|
// Imports
|
|
|
|
import {
|
|
|
|
insertQuery,
|
|
|
|
selectWhereAnyQuery,
|
|
|
|
updateWhereAnyQuery,
|
|
|
|
} from "../pg-query.js";
|
|
|
|
// Constants
|
|
|
|
const table = "silenced_tests";
|
2022-08-06 21:21:41 +00:00
|
|
|
const PG_DISABLED = process.env.POSTGRES_DISABLED;
|
|
|
|
|
|
|
|
const silencedMock = () => {
|
2022-08-09 04:29:10 +00:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
name: `failing`,
|
|
|
|
class: `failing.js`,
|
|
|
|
method: "FAKEMETHOD",
|
|
|
|
id: 0,
|
|
|
|
silencedUntil: new Date().toJSON(),
|
|
|
|
},
|
|
|
|
];
|
2022-08-06 21:21:41 +00:00
|
|
|
};
|
|
|
|
|
2022-05-08 01:36:22 +00:00
|
|
|
// Queries
|
2022-08-06 21:21:41 +00:00
|
|
|
export const getSilencedTests = async () => {
|
|
|
|
if (PG_DISABLED) return silencedMock();
|
2022-05-08 01:36:22 +00:00
|
|
|
const query = `SELECT * from ${table}`;
|
|
|
|
return pg.query(query);
|
|
|
|
};
|