fix(test): make chart tests working
This commit is contained in:
@ -208,7 +208,15 @@ export const db = new DataSource({
|
||||
migrations: ['../../migration/*.js'],
|
||||
});
|
||||
|
||||
export async function initDb() {
|
||||
export async function initDb(force = false) {
|
||||
if (force) {
|
||||
if (db.isInitialized) {
|
||||
await db.destroy();
|
||||
}
|
||||
await db.initialize();
|
||||
return;
|
||||
}
|
||||
|
||||
if (db.isInitialized) {
|
||||
// nop
|
||||
} else {
|
||||
|
@ -11,6 +11,11 @@ import { entity as PerUserFollowingChart } from './charts/entities/per-user-foll
|
||||
import { entity as PerUserDriveChart } from './charts/entities/per-user-drive.js';
|
||||
import { entity as ApRequestChart } from './charts/entities/ap-request.js';
|
||||
|
||||
import { entity as TestChart } from './charts/entities/test.js';
|
||||
import { entity as TestGroupedChart } from './charts/entities/test-grouped.js';
|
||||
import { entity as TestUniqueChart } from './charts/entities/test-unique.js';
|
||||
import { entity as TestIntersectionChart } from './charts/entities/test-intersection.js';
|
||||
|
||||
export const entities = [
|
||||
FederationChart.hour, FederationChart.day,
|
||||
NotesChart.hour, NotesChart.day,
|
||||
@ -24,4 +29,11 @@ export const entities = [
|
||||
PerUserFollowingChart.hour, PerUserFollowingChart.day,
|
||||
PerUserDriveChart.hour, PerUserDriveChart.day,
|
||||
ApRequestChart.hour, ApRequestChart.day,
|
||||
|
||||
...(process.env.NODE_ENV === 'test' ? [
|
||||
TestChart.hour, TestChart.day,
|
||||
TestGroupedChart.hour, TestGroupedChart.day,
|
||||
TestUniqueChart.hour, TestUniqueChart.day,
|
||||
TestIntersectionChart.hour, TestIntersectionChart.day,
|
||||
] : []),
|
||||
];
|
||||
|
Reference in New Issue
Block a user