Skip to content

A modern, self-hosted backup solution for secure, encrypted backups across local and cloud storage.

1.1 KB
Raw Blame
// import { drizzle } from 'drizzle-orm/better-sqlite3';
// import Database from 'better-sqlite3';
// import { migrate } from 'drizzle-orm/better-sqlite3/migrator';
import { initializeLogger } from '../src/utils/logger';
import 'dotenv/config';

// Mock templateLoader globally to avoid import.meta.url issues in Jest
jest.mock('../src/notifications/templateLoader', () => ({
	loadTemplate: jest.fn().mockReturnValue('<html>{{content}}</html>'),
	loadEmailWrapperTemplate: jest
		.fn()
		.mockReturnValue('<html><body>{{EMAIL_BODY_CONTENT}}</body></html>'),
	loadBackupTemplate: jest.fn().mockReturnValue('<div>Backup template</div>'),
}));

beforeAll(() => {
	console.log('--- JEST SETUP FILE IS RUNNING ---');
	//initialize logger
	initializeLogger();

	// Create an in-memory SQLite database for testing
	// const sqlite = new Database(':memory:');
	// const db = drizzle(sqlite);

	// Run migrations to set up the schema
	// migrate(db, { migrationsFolder: './drizzle' });

	// might need to mock the main 'db' export to use this test instance.
	// Jest's module mocking capabilities are perfect for this.
});